From nobody Tue Apr 30 17:04:19 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531775699759137.93003793858452; Mon, 16 Jul 2018 14:14:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67C1E30E2671; Mon, 16 Jul 2018 21:14:58 +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 251ED60C80; Mon, 16 Jul 2018 21:14:58 +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 CC5B34A465; Mon, 16 Jul 2018 21:14:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6GLET2s003176 for ; Mon, 16 Jul 2018 17:14:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB47E600CD; Mon, 16 Jul 2018 21:14:29 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-116-112.phx2.redhat.com [10.3.116.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BCD3600C9 for ; Mon, 16 Jul 2018 21:14:29 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Mon, 16 Jul 2018 17:14:22 -0400 Message-Id: <20180716211424.15582-2-jferlan@redhat.com> In-Reply-To: <20180716211424.15582-1-jferlan@redhat.com> References: <20180716211424.15582-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 1/3] conf: Add @target_bus to virDomainDefHasDeviceAddress 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 16 Jul 2018 21:14:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add the @target_bus argument which will allow a caller to pass the virDomainDiskBus onto which the @info (
) would be placed. This will allow logic to provide the bus for cold plugged devices to determine whether the about to be added device
is already present on the @bus. Just passing the @info isn't sufficient since, for example, ADDRESS_TYPE_DRIVE is used for both SCSI and IDE 's as well as 'scsi' and 'scsi_host' 's. Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 32 ++++++++++++++++++++++++++++---- src/conf/domain_conf.h | 3 ++- src/qemu/qemu_driver.c | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7396616eda..82df8012af 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3688,13 +3688,31 @@ virDomainDeviceGetInfo(virDomainDeviceDefPtr device) } =20 =20 +struct virDomainDefHasDeviceAddressIteratorData { + int target_bus; /* virDomainDiskBus or -1 */ + virDomainDeviceInfoPtr info; +}; + static int virDomainDefHasDeviceAddressIterator(virDomainDefPtr def ATTRIBUTE_UNUSED, - virDomainDeviceDefPtr dev ATTRIBUTE_U= NUSED, + virDomainDeviceDefPtr dev, virDomainDeviceInfoPtr info, void *opaque) { - virDomainDeviceInfoPtr needle =3D opaque; + struct virDomainDefHasDeviceAddressIteratorData *data =3D opaque; + int target_bus =3D data->target_bus; + virDomainDeviceInfoPtr needle =3D data->info; + + /* If the target_bus of the about to be cold plugged device needs + * to be checked and the currently to be matched device is a disk, + * then compare it's target bus against the new device. If they don't + * match, then no need to compare. For disks this ensures addresses + * using drive won't erroneously match if one is IDE and another is SC= SI. + * Likewise, for SCSI hostdev's this ensures the new hostdev doesn't + * erroneously match an IDE for the address comparison. */ + if (target_bus !=3D -1 && dev->type =3D=3D VIR_DOMAIN_DEVICE_DISK && + dev->data.disk->bus !=3D target_bus) + return 0; =20 /* break iteration if the info was found */ if (virDomainDeviceInfoAddressIsEqual(info, needle)) @@ -3933,12 +3951,18 @@ virDomainDeviceInfoIterate(virDomainDefPtr def, =20 bool virDomainDefHasDeviceAddress(virDomainDefPtr def, + int target_bus, virDomainDeviceInfoPtr info) { + struct virDomainDefHasDeviceAddressIteratorData data =3D { + .target_bus =3D target_bus, + .info =3D info, + }; + if (virDomainDeviceInfoIterateInternal(def, virDomainDefHasDeviceAddressIte= rator, true, - info) < 0) + &data) < 0) return true; =20 return false; @@ -17508,7 +17532,7 @@ virDomainMemoryInsert(virDomainDefPtr def, int id =3D def->nmems; =20 if (mem->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && - virDomainDefHasDeviceAddress(def, &mem->info)) { + virDomainDefHasDeviceAddress(def, -1, &mem->info)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain already contains a device with the same " "address")); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0f10e242fd..82231161c6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2912,8 +2912,9 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def, void *opaque); =20 bool virDomainDefHasDeviceAddress(virDomainDefPtr def, + int target_bus, virDomainDeviceInfoPtr info) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK; =20 void virDomainDefFree(virDomainDefPtr vm); =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8fae46370e..5f91d463ae 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8082,7 +8082,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, =20 case VIR_DOMAIN_DEVICE_RNG: if (dev->data.rng->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_N= ONE && - virDomainDefHasDeviceAddress(vmdef, &dev->data.rng->info)) { + virDomainDefHasDeviceAddress(vmdef, -1, &dev->data.rng->info))= { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("a device with the same address already exist= s ")); return -1; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 17:04:19 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15317757088591001.9010500842091; Mon, 16 Jul 2018 14:15:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D51DC04AC4C; Mon, 16 Jul 2018 21:15:05 +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 BE727CABF6; Mon, 16 Jul 2018 21:15:04 +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 4095918037EF; Mon, 16 Jul 2018 21:15:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6GLEUfr003183 for ; Mon, 16 Jul 2018 17:14:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E10F600CD; Mon, 16 Jul 2018 21:14:30 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-116-112.phx2.redhat.com [10.3.116.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C705600C9 for ; Mon, 16 Jul 2018 21:14:29 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Mon, 16 Jul 2018 17:14:23 -0400 Message-Id: <20180716211424.15582-3-jferlan@redhat.com> In-Reply-To: <20180716211424.15582-1-jferlan@redhat.com> References: <20180716211424.15582-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 2/3] qemu: Check for existing address when cold attach device 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 16 Jul 2018 21:15:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that virDomainDefCompatibleDevice accepts an action, let's use that to generically determine whether a to be cold plugged device with a defined
would conflict with any existing address for the domain config. This replaces the RNG check in qemuDomainAttachDeviceConfig. This type of check would need to be made before a device is inserted into its domain device list (disk, rng, hostdev, etc.). This type of check cannot be done during the post parse processing because the check would conflict with itself as the device would be placed onto the its device list prior to post parse. By comparison this is similar to the validation phase checks in virDomainDefCheckDuplicateDriveAddresses that occur during define/startup processing, but are not run during config attach of a live guest. Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 22 ++++++++++++++++++++++ src/qemu/qemu_driver.c | 7 ------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 82df8012af..fd5bc10c82 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28270,11 +28270,25 @@ virDomainDefCompatibleDevice(virDomainDefPtr def, virDomainDeviceAction action, bool live) { + int target_bus =3D -1; virDomainCompatibleDeviceData data =3D { .newInfo =3D virDomainDeviceGetInfo(dev), .oldInfo =3D NULL, }; =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_DISK) { + target_bus =3D dev->data.disk->bus; + } else if (dev->type =3D=3D VIR_DOMAIN_DEVICE_HOSTDEV && + dev->data.hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_SUBS= YS) { + virDomainHostdevSubsysPtr subsys =3D &dev->data.hostdev->source.su= bsys; + + /* If using 'scsi' or 'scsi_host', then the device can be placed + * on the same bus as a , so account for that */ + if (subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI || + subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) + target_bus =3D VIR_DOMAIN_DISK_BUS_SCSI; + } + if (oldDev) data.oldInfo =3D virDomainDeviceGetInfo(oldDev); =20 @@ -28288,6 +28302,14 @@ virDomainDefCompatibleDevice(virDomainDefPtr def, return -1; } =20 + if (action =3D=3D VIR_DOMAIN_DEVICE_ACTION_ATTACH && !live && data.new= Info && + data.newInfo->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + virDomainDefHasDeviceAddress(def, target_bus, data.newInfo)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("a device with the same address already exists")); + return -1; + } + if (!virDomainDefHasUSB(def) && def->os.type !=3D VIR_DOMAIN_OSTYPE_EXE && virDomainDeviceIsUSB(dev)) { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5f91d463ae..7d519c0714 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8081,13 +8081,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, break; =20 case VIR_DOMAIN_DEVICE_RNG: - if (dev->data.rng->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_N= ONE && - virDomainDefHasDeviceAddress(vmdef, -1, &dev->data.rng->info))= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("a device with the same address already exist= s ")); - return -1; - } - if (VIR_APPEND_ELEMENT(vmdef->rngs, vmdef->nrngs, dev->data.rng) <= 0) return -1; dev->data.rng =3D NULL; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 17:04:19 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531775678899824.4601575924202; Mon, 16 Jul 2018 14:14:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BA12307CF25; Mon, 16 Jul 2018 21:14:37 +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 3440460BE4; Mon, 16 Jul 2018 21:14:36 +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 2A14718037ED; Mon, 16 Jul 2018 21:14:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6GLEUe1003191 for ; Mon, 16 Jul 2018 17:14:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD487600C9; Mon, 16 Jul 2018 21:14:30 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-116-112.phx2.redhat.com [10.3.116.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FD3D600CD for ; Mon, 16 Jul 2018 21:14:30 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Mon, 16 Jul 2018 17:14:24 -0400 Message-Id: <20180716211424.15582-4-jferlan@redhat.com> In-Reply-To: <20180716211424.15582-1-jferlan@redhat.com> References: <20180716211424.15582-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 3/3] qemu: Use the correct vm def on cold attach 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 16 Jul 2018 21:14:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1559867 When attaching a device to the domain we need to be sure to use the correct domain definition (vm->def or vm->newDef) when calling virDomainDeviceDefParse because the post parse processing algorithms that may assign an address for the device will use whatever domain definition was passed in. Additionally, some devices (SCSI hostdev and SCSI disk) use algorithms that rely on knowing what already exists of the other type when generating the new device's address. Using the wrong VM definition could result in duplicated addresses. In the case of the bz, two hostdev's with no domain address provided were added to the running domain's config only. However, the parsing algorithm used the live domain in order to figure out the host device address resulting in the same address being used and a subsequent start failing due to duplicate address. Fix this by separating the checks/code into CONFIG and LIVE processing using the correct definition for each block and performing cleanup for both options as necessary. Signed-off-by: John Ferlan --- src/qemu/qemu_driver.c | 52 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7d519c0714..3dbd5c62d2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8473,7 +8473,8 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr v= m, { virDomainDefPtr vmdef =3D NULL; virQEMUDriverConfigPtr cfg =3D NULL; - virDomainDeviceDefPtr dev =3D NULL, dev_copy =3D NULL; + virDomainDeviceDefPtr devConf =3D NULL; + virDomainDeviceDefPtr devLive =3D NULL; int ret =3D -1; virCapsPtr caps =3D NULL; unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE | @@ -8487,49 +8488,43 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr= vm, if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) goto cleanup; =20 - dev =3D dev_copy =3D virDomainDeviceDefParse(xml, vm->def, - caps, driver->xmlopt, - parse_flags); - if (dev =3D=3D NULL) - goto cleanup; - - if (virDomainDeviceValidateAliasForHotplug(vm, dev, flags) < 0) - goto cleanup; - - if (flags & VIR_DOMAIN_AFFECT_CONFIG && - flags & VIR_DOMAIN_AFFECT_LIVE) { - /* If we are affecting both CONFIG and LIVE - * create a deep copy of device as adding - * to CONFIG takes one instance. - */ - dev_copy =3D virDomainDeviceDefCopy(dev, vm->def, caps, driver->xm= lopt); - if (!dev_copy) - goto cleanup; - } - + /* The config and live post processing address auto-generation algorit= hms + * rely on the correct vm->def or vm->newDef being passed, so call the + * device parse based on which definition is in use */ if (flags & VIR_DOMAIN_AFFECT_CONFIG) { - /* Make a copy for updated domain. */ vmdef =3D virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt); if (!vmdef) goto cleanup; =20 - if (virDomainDefCompatibleDevice(vmdef, dev, NULL, + if (!(devConf =3D virDomainDeviceDefParse(xml, vmdef, caps, + driver->xmlopt, parse_flag= s))) + goto cleanup; + + if (virDomainDefCompatibleDevice(vmdef, devConf, NULL, VIR_DOMAIN_DEVICE_ACTION_ATTACH, false) < 0) goto cleanup; - if ((ret =3D qemuDomainAttachDeviceConfig(vmdef, dev, caps, + + if ((ret =3D qemuDomainAttachDeviceConfig(vmdef, devConf, caps, parse_flags, driver->xmlopt)) < 0) goto cleanup; } =20 if (flags & VIR_DOMAIN_AFFECT_LIVE) { - if (virDomainDefCompatibleDevice(vm->def, dev_copy, NULL, + if (!(devLive =3D virDomainDeviceDefParse(xml, vm->def, caps, + driver->xmlopt, parse_flag= s))) + goto cleanup; + + if (virDomainDeviceValidateAliasForHotplug(vm, devLive, flags) < 0) + goto cleanup; + + if (virDomainDefCompatibleDevice(vm->def, devLive, NULL, VIR_DOMAIN_DEVICE_ACTION_ATTACH, true) < 0) goto cleanup; =20 - if ((ret =3D qemuDomainAttachDeviceLive(vm, dev_copy, driver)) < 0) + if ((ret =3D qemuDomainAttachDeviceLive(vm, devLive, driver)) < 0) goto cleanup; /* * update domain status forcibly because the domain status may be @@ -8553,9 +8548,8 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr v= m, =20 cleanup: virDomainDefFree(vmdef); - if (dev !=3D dev_copy) - virDomainDeviceDefFree(dev_copy); - virDomainDeviceDefFree(dev); + virDomainDeviceDefFree(devConf); + virDomainDeviceDefFree(devLive); virObjectUnref(cfg); virObjectUnref(caps); =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list