From nobody Mon Apr 29 00:29:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515586755193564.6290879938621; Wed, 10 Jan 2018 04:19:15 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 791A6A3289; Wed, 10 Jan 2018 12:18:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35D708306E; Wed, 10 Jan 2018 12:18:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6519118033D9; Wed, 10 Jan 2018 12:18:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0ACIBke027080 for ; Wed, 10 Jan 2018 07:18:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B2328246B; Wed, 10 Jan 2018 12:18:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEC0582E20; Wed, 10 Jan 2018 12:18:09 +0000 (UTC) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3490F780E5; Wed, 10 Jan 2018 12:18:05 +0000 (UTC) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id CD953882382BB; Wed, 10 Jan 2018 20:17:46 +0800 (CST) Received: from HSH1000044456.huawei.com (10.184.157.230) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.361.1; Wed, 10 Jan 2018 20:17:41 +0800 From: Wu Zongyong To: Date: Wed, 10 Jan 2018 20:14:49 +0800 Message-ID: <1515586491-2808-2-git-send-email-cordius.wu@huawei.com> In-Reply-To: <1515586491-2808-1-git-send-email-cordius.wu@huawei.com> References: <1515586491-2808-1-git-send-email-cordius.wu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.157.230] X-CFilter-Loop: Reflected X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 10 Jan 2018 12:18:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 10 Jan 2018 12:18:06 +0000 (UTC) for IP:'45.249.212.191' DOMAIN:'szxga05-in.huawei.com' HELO:'huawei.com' FROM:'cordius.wu@huawei.com' RCPT:'' X-RedHat-Spam-Score: -0.022 (RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD) 45.249.212.191 szxga05-in.huawei.com 45.249.212.191 szxga05-in.huawei.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: weijinfen@huawei.com, wanzongshun@huawei.com, eskultet@redhat.com Subject: [libvirt] [PATCH 1/3] nodedev: add macro guard to node_device_udev header file X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 10 Jan 2018 12:19:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Wu Zongyong --- src/node_device/node_device_udev.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_devi= ce_udev.h index f15e520..300f57e 100644 --- a/src/node_device/node_device_udev.h +++ b/src/node_device/node_device_udev.h @@ -19,10 +19,15 @@ * * Author: Dave Allan */ +#ifndef __VIR_NODE_DEVICE_UDEV_H__ +# define __VIR_NODE_DEVICE_UDEV_H__ =20 -#include -#include +# include +# include =20 -#define SYSFS_DATA_SIZE 4096 -#define DMI_DEVPATH "/sys/devices/virtual/dmi/id" -#define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id" +# define SYSFS_DATA_SIZE 4096 +# define DMI_DEVPATH "/sys/devices/virtual/dmi/id" +# define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id" + + +#endif /* __VIR_NODE_DEVICE_UDEV_H__ */ --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:29:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515586737516103.10260924539557; Wed, 10 Jan 2018 04:18:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB6A8C01F296; Wed, 10 Jan 2018 12:18:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2FF6C83283; Wed, 10 Jan 2018 12:18:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A8445410AD; Wed, 10 Jan 2018 12:18:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0ACIHBH027141 for ; Wed, 10 Jan 2018 07:18:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 805867A2FD; Wed, 10 Jan 2018 12:18:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C76BA7A2E1; Wed, 10 Jan 2018 12:18:15 +0000 (UTC) Received: from huawei.com (unknown [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FCCA52120; Wed, 10 Jan 2018 12:18:07 +0000 (UTC) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5AF55BD715C7F; Wed, 10 Jan 2018 20:17:52 +0800 (CST) Received: from HSH1000044456.huawei.com (10.184.157.230) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.361.1; Wed, 10 Jan 2018 20:17:43 +0800 From: Wu Zongyong To: Date: Wed, 10 Jan 2018 20:14:50 +0800 Message-ID: <1515586491-2808-3-git-send-email-cordius.wu@huawei.com> In-Reply-To: <1515586491-2808-1-git-send-email-cordius.wu@huawei.com> References: <1515586491-2808-1-git-send-email-cordius.wu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.157.230] X-CFilter-Loop: Reflected X-Greylist: Delayed for 48:39:48 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 10 Jan 2018 12:18:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 10 Jan 2018 12:18:08 +0000 (UTC) for IP:'45.249.212.32' DOMAIN:'[45.249.212.32]' HELO:'huawei.com' FROM:'cordius.wu@huawei.com' RCPT:'' X-RedHat-Spam-Score: 1.272 * (RDNS_NONE, SPF_HELO_PASS, SPF_PASS) 45.249.212.32 [45.249.212.32] 45.249.212.32 [45.249.212.32] X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: weijinfen@huawei.com, wanzongshun@huawei.com, eskultet@redhat.com Subject: [libvirt] [PATCH 2/3] nodedev: update mdev_types caps before dumpxml X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 10 Jan 2018 12:18:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In current implemention, mdev_types caps keep constant all the time. But, it is possible that a device capable of mdev_types sometime(for example:bind to proper driver) and incapable of mdev_types at other times(for example: unbind from its driver). We should keep the info of xml dumped out consistent with real status of the device. Signed-off-by: Wu Zongyong Reviewed-by: Erik Skultety --- src/node_device/node_device_linux_sysfs.c | 22 ++++++++++++++++++ src/node_device/node_device_udev.c | 37 ++++++++++++++++++++++++++-= ---- src/node_device/node_device_udev.h | 3 +++ 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/no= de_device_linux_sysfs.c index 6f438e5..388ffb4 100644 --- a/src/node_device/node_device_linux_sysfs.c +++ b/src/node_device/node_device_linux_sysfs.c @@ -29,6 +29,7 @@ #include "dirname.h" #include "node_device_driver.h" #include "node_device_hal.h" +#include "node_device_udev.h" #include "node_device_linux_sysfs.h" #include "virerror.h" #include "viralloc.h" @@ -175,6 +176,25 @@ nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCIDe= vPtr pci_dev) return ret; } =20 +static int +nodeDeviceSysfsGetPCIMdevTypesCaps(const char *sysfsPath, + virNodeDevCapPCIDevPtr pci_dev) +{ + size_t i; + + /* this could be a refresh, so clear out the old data */ + for (i =3D 0; i < pci_dev->nmdev_types; i++) + virNodeDevCapMdevTypeFree(pci_dev->mdev_types[i]); + VIR_FREE(pci_dev->mdev_types); + pci_dev->nmdev_types =3D 0; + pci_dev->flags &=3D ~VIR_NODE_DEV_CAP_FLAG_PCI_MDEV; + + if (udevPCISysfsGetMdevTypesCap(sysfsPath, pci_dev) < 0) + return -1; + + return 0; +} + =20 /* nodeDeviceSysfsGetPCIRelatedCaps() get info that is stored in sysfs * about devices related to this device, i.e. things that can change @@ -190,6 +210,8 @@ nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPa= th, return -1; if (nodeDeviceSysfsGetPCIIOMMUGroupCaps(pci_dev) < 0) return -1; + if (nodeDeviceSysfsGetPCIMdevTypesCaps(sysfsPath, pci_dev) < 0) + return -1; return 0; } =20 diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index e0fca61..7b0014e 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -506,6 +506,37 @@ udevPCIGetMdevTypesCap(struct udev_device *device, } =20 =20 +int +udevPCISysfsGetMdevTypesCap(const char *sysfsPath, + virNodeDevCapPCIDevPtr pci_dev) +{ + int ret =3D -1; + struct udev *udev =3D NULL; + struct udev_device *device =3D NULL; + udevEventDataPtr priv =3D driver->privateData; + + virObjectLock(priv); + udev =3D udev_monitor_get_udev(priv->udev_monitor); + device =3D udev_device_new_from_syspath(udev, sysfsPath); + virObjectUnlock(priv); + + if (!device) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to create udev device from path %s"), + sysfsPath); + goto cleanup; + } + + if (udevPCIGetMdevTypesCap(device, pci_dev) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + udev_device_unref(device); + return ret; +} + + static int udevProcessPCI(struct udev_device *device, virNodeDeviceDefPtr def) @@ -597,12 +628,6 @@ udevProcessPCI(struct udev_device *device, } } =20 - /* check whether the device is mediated devices framework capable, if = so, - * process it - */ - if (udevPCIGetMdevTypesCap(device, pci_dev) < 0) - goto cleanup; - ret =3D 0; =20 cleanup: diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_devi= ce_udev.h index 300f57e..bbdc70f 100644 --- a/src/node_device/node_device_udev.h +++ b/src/node_device/node_device_udev.h @@ -29,5 +29,8 @@ # define DMI_DEVPATH "/sys/devices/virtual/dmi/id" # define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id" =20 +int +udevPCISysfsGetMdevTypesCap(const char *sysfsPath, virNodeDevCapPCIDevPtr = pci_dev); + =20 #endif /* __VIR_NODE_DEVICE_UDEV_H__ */ --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:29:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515586786191102.71252064176213; Wed, 10 Jan 2018 04:19:46 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D7373A252; Wed, 10 Jan 2018 12:19:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01CD3811B6; Wed, 10 Jan 2018 12:19:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1CCDF410B3; Wed, 10 Jan 2018 12:19:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0ACIcPE027336 for ; Wed, 10 Jan 2018 07:18:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1299080E97; Wed, 10 Jan 2018 12:18:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1083680E1C; Wed, 10 Jan 2018 12:18:35 +0000 (UTC) Received: from huawei.com (unknown [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0EA7C780FC; Wed, 10 Jan 2018 12:18:10 +0000 (UTC) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7360A863F79A5; Wed, 10 Jan 2018 20:17:52 +0800 (CST) Received: from HSH1000044456.huawei.com (10.184.157.230) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.361.1; Wed, 10 Jan 2018 20:17:44 +0800 From: Wu Zongyong To: Date: Wed, 10 Jan 2018 20:14:51 +0800 Message-ID: <1515586491-2808-4-git-send-email-cordius.wu@huawei.com> In-Reply-To: <1515586491-2808-1-git-send-email-cordius.wu@huawei.com> References: <1515586491-2808-1-git-send-email-cordius.wu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.157.230] X-CFilter-Loop: Reflected X-Greylist: Delayed for 48:39:55 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 10 Jan 2018 12:18:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 10 Jan 2018 12:18:15 +0000 (UTC) for IP:'45.249.212.32' DOMAIN:'[45.249.212.32]' HELO:'huawei.com' FROM:'cordius.wu@huawei.com' RCPT:'' X-RedHat-Spam-Score: 1.272 * (RDNS_NONE, SPF_HELO_PASS, SPF_PASS) 45.249.212.32 [45.249.212.32] 45.249.212.32 [45.249.212.32] X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: weijinfen@huawei.com, wanzongshun@huawei.com, eskultet@redhat.com Subject: [libvirt] [PATCH 3/3] nodedev: update caps before invoking nodedev driver interfaces X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 10 Jan 2018 12:19:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some capabilities of node devices rely on what driver they bound to, and therefore, these capabilities may change when the driver change. So, it is necessary to manually update devices' capabilities each time before nodedev driver interfaces invoked. Signed-off-by: Wu Zongyong --- src/node_device/node_device_driver.c | 55 ++++++++++++++++++++++++++++++++= ++++ 1 file changed, 55 insertions(+) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index facfeb6..d854516 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -155,6 +155,42 @@ nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def ATT= RIBUTE_UNUSED) #endif =20 =20 +static int +nodeConnectUpdateAllNodeDevicesCaps(virConnectPtr conn, + virNodeDeviceObjListFilter filter) +{ + int ret =3D -1; + size_t i; + virNodeDevicePtr *devices; + + if (virNodeDeviceObjListExport(conn, driver->devs, &devices, filter, 0= ) < 0) + return -1; + + for (i =3D 0; devices[i]; i++) { + virNodeDeviceObjPtr obj; + virNodeDeviceDefPtr def; + + if (!(obj =3D virNodeDeviceObjListFindByName(driver->devs, devices= [i]->name))) + goto cleanup; + def =3D virNodeDeviceObjGetDef(obj); + + if (nodeDeviceUpdateCaps(def) < 0) { + virNodeDeviceObjEndAPI(&obj); + goto cleanup; + } + + virNodeDeviceObjEndAPI(&obj); + } + + ret =3D 0; + cleanup: + for (i =3D 0; devices[i]; i++) + virObjectUnref(devices[i]); + VIR_FREE(devices); + return ret; +} + + void nodeDeviceLock(void) { @@ -179,6 +215,9 @@ nodeNumOfDevices(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 + if (nodeConnectUpdateAllNodeDevicesCaps(conn, virNodeNumOfDevicesCheck= ACL) < 0) + return -1; + return virNodeDeviceObjListNumOfDevices(driver->devs, conn, cap, virNodeNumOfDevicesCheckACL); } @@ -196,6 +235,9 @@ nodeListDevices(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 + if (nodeConnectUpdateAllNodeDevicesCaps(conn, virNodeListDevicesCheckA= CL) < 0) + return -1; + return virNodeDeviceObjListGetNames(driver->devs, conn, virNodeListDevicesCheckACL, cap, names, maxnames); @@ -212,6 +254,10 @@ nodeConnectListAllNodeDevices(virConnectPtr conn, if (virConnectListAllNodeDevicesEnsureACL(conn) < 0) return -1; =20 + if (nodeConnectUpdateAllNodeDevicesCaps(conn, + virConnectListAllNodeDevicesCh= eckACL) < 0) + return -1; + return virNodeDeviceObjListExport(conn, driver->devs, devices, virConnectListAllNodeDevicesCheckACL, flags); @@ -248,6 +294,9 @@ nodeDeviceLookupByName(virConnectPtr conn, if (virNodeDeviceLookupByNameEnsureACL(conn, def) < 0) goto cleanup; =20 + if (nodeDeviceUpdateCaps(def) < 0) + goto cleanup; + if ((device =3D virGetNodeDevice(conn, name))) { if (VIR_STRDUP(device->parent, def->parent) < 0) { virObjectUnref(device); @@ -370,6 +419,9 @@ nodeDeviceNumOfCaps(virNodeDevicePtr device) if (virNodeDeviceNumOfCapsEnsureACL(device->conn, def) < 0) goto cleanup; =20 + if (nodeDeviceUpdateCaps(def) < 0) + goto cleanup; + for (caps =3D def->caps; caps; caps =3D caps->next) { ++ncaps; =20 @@ -411,6 +463,9 @@ nodeDeviceListCaps(virNodeDevicePtr device, if (virNodeDeviceListCapsEnsureACL(device->conn, def) < 0) goto cleanup; =20 + if (nodeDeviceUpdateCaps(def) < 0) + goto cleanup; + for (caps =3D def->caps; caps && ncaps < maxnames; caps =3D caps->next= ) { if (VIR_STRDUP(names[ncaps++], virNodeDevCapTypeToString(caps->dat= a.type)) < 0) goto cleanup; --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list