From nobody Sat Apr 20 02:19:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1683565863; cv=none; d=zohomail.com; s=zohoarc; b=H0lubOaNl1s2QnQEmxvH3twHTib9/ZI8SsxA8MxBxlDnNoZXH20nnMhnBKGQHtYcN75FpkgiDGyEzIC7pvEeS9qNwDkLvB6Ocf6xOuVb4eTfPg57ul87DF3ry0YUag/gJ2NVXdg6tTGXwgsy+oWFx9Xsm58FKDW8n0hxlLV/txI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683565863; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=TTJ1gSo53zes75FH2fSTu0DXSpW19nchRfr+jq7bukM=; b=FB5NqWr7g5uf9vI+ffvbHOHBBlZ5gN17yvpNfMnd0tTKWZuZuRc74N4ymBojPCkYCwzLWcaxFZKOniJUn3dhjL254W1tWLwZfK4YYudLem2eYR6IZX4rWW56w4u7MirIyTCB3U4ULJnRuRNfVwJkZNaF/k3Avy090clXVxzBNy4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1683565863054594.2327971516384; Mon, 8 May 2023 10:11:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-VeebMBpONGqlr9tLSp4QRA-1; Mon, 08 May 2023 13:11:00 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B9E743C0F664; Mon, 8 May 2023 17:10:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23F032026D16; Mon, 8 May 2023 17:10:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CB34519465A0; Mon, 8 May 2023 17:10:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EC54C1946595 for ; Mon, 8 May 2023 17:10:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DC1542166B41; Mon, 8 May 2023 17:10:53 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D46D92166B40 for ; Mon, 8 May 2023 17:10:53 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B88131C01B3F for ; Mon, 8 May 2023 17:10:53 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-zLjfnpFTPeeqWy6aZNLZ7g-1; Mon, 08 May 2023 13:10:52 -0400 Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 348H7XRj032541; Mon, 8 May 2023 17:10:51 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qf4g6h8s1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 May 2023 17:10:51 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3484lfRQ024440; Mon, 8 May 2023 17:10:49 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3qdeh6h89y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 May 2023 17:10:48 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 348HAkZn5046846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 May 2023 17:10:46 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9FF662004D; Mon, 8 May 2023 17:10:46 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 885C120043; Mon, 8 May 2023 17:10:46 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.171.143.189]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 May 2023 17:10:46 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683565862; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TTJ1gSo53zes75FH2fSTu0DXSpW19nchRfr+jq7bukM=; b=Yg3fzeqzAhqmZfBTsN5Qr9wI0F8oE0eF/LfHyhB9rShfNeuGFm4C2uZRaIM9pGO9XkW8qZ c/ecDNxCmHjPbXgQis22zOz67oVlvXSJti3al4l3mzrKgz5129vAV2QJy18qP9O3vJJwxe NbCJi9qGMpQAketJrwyGCDP0xY76uXk= X-MC-Unique: VeebMBpONGqlr9tLSp4QRA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: zLjfnpFTPeeqWy6aZNLZ7g-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH] nodedev: update transient mdevs Date: Mon, 8 May 2023 19:10:46 +0200 Message-Id: <20230508171046.83422-1-fiuczy@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: UnXLijYjGe49BbnneywqrM9IkwwmikY- X-Proofpoint-ORIG-GUID: UnXLijYjGe49BbnneywqrM9IkwwmikY- X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-08_12,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 clxscore=1011 suspectscore=0 malwarescore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305080115 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jjongsma@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683565864326100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Instead of updating defined mdevs only add another update for active devices as well to cover transient mdev devices as well. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2143158 Signed-off-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 3cac25a10c..a2d0600560 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -1636,6 +1636,24 @@ virMdevctlListDefined(virNodeDeviceDef ***devs, char= **errmsg) } =20 =20 +static int +virMdevctlListActive(virNodeDeviceDef ***devs, char **errmsg) +{ + int status; + g_autofree char *output =3D NULL; + g_autoptr(virCommand) cmd =3D nodeDeviceGetMdevctlListCommand(false, &= output, errmsg); + + if (virCommandRun(cmd, &status) < 0 || status !=3D 0) { + return -1; + } + + if (!output) + return -1; + + return nodeDeviceParseMdevctlJSON(output, devs); +} + + typedef struct _virMdevctlForEachData virMdevctlForEachData; struct _virMdevctlForEachData { int ndefs; @@ -1699,6 +1717,8 @@ int nodeDeviceUpdateMediatedDevices(void) { g_autofree virNodeDeviceDef **defs =3D NULL; + g_autofree virNodeDeviceDef **act_defs =3D NULL; + int act_ndefs =3D 0; g_autofree char *errmsg =3D NULL; g_autofree char *mdevctl =3D NULL; virMdevctlForEachData data =3D { 0, }; @@ -1725,6 +1745,17 @@ nodeDeviceUpdateMediatedDevices(void) if (nodeDeviceUpdateMediatedDevice(defs[i]) < 0) return -1; =20 + /* Update active/transient mdev devices */ + if ((act_ndefs =3D virMdevctlListActive(&act_defs, &errmsg)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to query mdevs from mdevctl: %1$s"), errm= sg); + return -1; + } + + for (i =3D 0; i < act_ndefs; i++) + if (nodeDeviceUpdateMediatedDevice(act_defs[i]) < 0) + return -1; + return 0; } =20 --=20 2.39.0