diff --git a/0001-Extract-stats-functions-from-the-qemu-driver.patch b/0001-Extract-stats-functions-from-the-qemu-driver.patch index 05f86f9..039543d 100644 --- a/0001-Extract-stats-functions-from-the-qemu-driver.patch +++ b/0001-Extract-stats-functions-from-the-qemu-driver.patch @@ -235,7 +235,7 @@ Index: libvirt-5.2.0/src/libvirt_private.syms =================================================================== --- libvirt-5.2.0.orig/src/libvirt_private.syms +++ libvirt-5.2.0/src/libvirt_private.syms -@@ -671,6 +671,9 @@ virDomainConfNWFilterInstantiate; +@@ -672,6 +672,9 @@ virDomainConfNWFilterInstantiate; virDomainConfNWFilterTeardown; virDomainConfVMNWFilterTeardown; @@ -245,7 +245,7 @@ Index: libvirt-5.2.0/src/libvirt_private.syms # conf/interface_conf.h virInterfaceDefFormat; -@@ -1583,6 +1586,7 @@ virCgroupGetMemoryUsage; +@@ -1584,6 +1587,7 @@ virCgroupGetMemoryUsage; virCgroupGetMemSwapHardLimit; virCgroupGetMemSwapUsage; virCgroupGetPercpuStats; diff --git a/22dc3e94-revert-f1d65853.patch b/22dc3e94-revert-f1d65853.patch new file mode 100644 index 0000000..2366a8f --- /dev/null +++ b/22dc3e94-revert-f1d65853.patch @@ -0,0 +1,40 @@ +commit 22dc3e94c24b4d9a6c28beda91b9b283eb9b0251 +Author: Michal Privoznik +Date: Thu Apr 11 15:40:51 2019 +0200 + + Revert "domain_conf: check device address before attach" + + This reverts commit f1d6585300001c7b23b8796a0faa4411c3531996. + + Turns out, this caused a regression. There is this (perhaps less + known) semantic of virDomainAttachDevice() where if the device + the API is trying to attach is a CDROM/floppy that is already in + the domain the attach request is handled as 'change the media in + the drive'. + + We have a better fix anyways. + + Signed-off-by: Michal Privoznik + Tested-by: Daniel Henrique Barboza + Reviewed-by: Jim Fehlig + +Index: libvirt-5.2.0/src/conf/domain_conf.c +=================================================================== +--- libvirt-5.2.0.orig/src/conf/domain_conf.c ++++ libvirt-5.2.0/src/conf/domain_conf.c +@@ -28589,15 +28589,6 @@ virDomainDefCompatibleDevice(virDomainDe + if (oldDev) + data.oldInfo = virDomainDeviceGetInfo(oldDev); + +- if (action == VIR_DOMAIN_DEVICE_ACTION_ATTACH && +- data.newInfo && +- data.newInfo->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && +- virDomainDefHasDeviceAddress(def, data.newInfo)) { +- virReportError(VIR_ERR_OPERATION_INVALID, "%s", +- _("Domain already contains a device with the same address")); +- return -1; +- } +- + if (action == VIR_DOMAIN_DEVICE_ACTION_UPDATE && + live && + (data.newInfo && data.oldInfo && diff --git a/89237d53-conf-expose-virDomainSCSIDriveAddressIsUsed.patch b/89237d53-conf-expose-virDomainSCSIDriveAddressIsUsed.patch new file mode 100644 index 0000000..9163a52 --- /dev/null +++ b/89237d53-conf-expose-virDomainSCSIDriveAddressIsUsed.patch @@ -0,0 +1,54 @@ +commit 89237d534f0fe950d06a2081089154160c6c2224 +Author: Michal Privoznik +Date: Thu Apr 11 15:44:14 2019 +0200 + + conf: Expose virDomainSCSIDriveAddressIsUsed + + This function checks if given drive address is already present in + passed domain definition. Expose the function as it will be used + shortly. + + Signed-off-by: Michal Privoznik + Tested-by: Daniel Henrique Barboza + Reviewed-by: Jim Fehlig + +Index: libvirt-5.2.0/src/conf/domain_conf.c +=================================================================== +--- libvirt-5.2.0.orig/src/conf/domain_conf.c ++++ libvirt-5.2.0/src/conf/domain_conf.c +@@ -4644,7 +4644,7 @@ virDomainDriveAddressIsUsedByHostdev(con + * Return true if the SCSI drive address is already in use, false + * otherwise. + */ +-static bool ++bool + virDomainSCSIDriveAddressIsUsed(const virDomainDef *def, + const virDomainDeviceDriveAddress *addr) + { +Index: libvirt-5.2.0/src/conf/domain_conf.h +=================================================================== +--- libvirt-5.2.0.orig/src/conf/domain_conf.h ++++ libvirt-5.2.0/src/conf/domain_conf.h +@@ -2697,6 +2697,10 @@ virDomainXMLNamespacePtr + virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt) + ATTRIBUTE_NONNULL(1); + ++bool ++virDomainSCSIDriveAddressIsUsed(const virDomainDef *def, ++ const virDomainDeviceDriveAddress *addr); ++ + int virDomainDefPostParse(virDomainDefPtr def, + virCapsPtr caps, + unsigned int parseFlags, +Index: libvirt-5.2.0/src/libvirt_private.syms +=================================================================== +--- libvirt-5.2.0.orig/src/libvirt_private.syms ++++ libvirt-5.2.0/src/libvirt_private.syms +@@ -534,6 +534,7 @@ virDomainRunningReasonTypeToString; + virDomainSaveConfig; + virDomainSaveStatus; + virDomainSaveXML; ++virDomainSCSIDriveAddressIsUsed; + virDomainSeclabelTypeFromString; + virDomainSeclabelTypeToString; + virDomainShmemDefEquals; diff --git a/ddc72f99-qemu-check-dup-drive-address.patch b/ddc72f99-qemu-check-dup-drive-address.patch new file mode 100644 index 0000000..0bf1a1b --- /dev/null +++ b/ddc72f99-qemu-check-dup-drive-address.patch @@ -0,0 +1,30 @@ +commit ddc72f99027b063feaf34e5fda89916b6b2c8943 +Author: Michal Privoznik +Date: Thu Apr 11 15:45:27 2019 +0200 + + qemu_hotplug: Check for duplicate drive addresses + + This tries to fix the same problem as f1d65853000 but it's doing + so in a less invasive way. + + Signed-off-by: Michal Privoznik + Tested-by: Daniel Henrique Barboza + Reviewed-by: Jim Fehlig + +Index: libvirt-5.2.0/src/qemu/qemu_hotplug.c +=================================================================== +--- libvirt-5.2.0.orig/src/qemu/qemu_hotplug.c ++++ libvirt-5.2.0/src/qemu/qemu_hotplug.c +@@ -1181,6 +1181,12 @@ qemuDomainAttachSCSIDisk(virQEMUDriverPt + return -1; + } + ++ if (virDomainSCSIDriveAddressIsUsed(vm->def, &disk->info.addr.drive)) { ++ virReportError(VIR_ERR_OPERATION_INVALID, "%s", ++ _("Domain already contains a disk with that address")); ++ return -1; ++ } ++ + /* Let's make sure the disk has a controller defined and loaded before + * trying to add it. The controller used by the disk must exist before a + * qemu command line string is generated. diff --git a/ee2c5ef3-test-scsi-disk.patch b/ee2c5ef3-test-scsi-disk.patch new file mode 100644 index 0000000..54c5a96 --- /dev/null +++ b/ee2c5ef3-test-scsi-disk.patch @@ -0,0 +1,56 @@ +commit ee2c5ef39fd91345893904433c6f458685543af5 +Author: Michal Privoznik +Date: Thu Apr 11 16:23:38 2019 +0200 + + qemuhotplugtest: Don't plug a SCSI disk at unit 7 + + Unit number 7 is kind of special. It's reserved for SCSI + controller. The comment in virDomainSCSIDriveAddressIsUsed() + summarizes that pretty nicely. Libvirt would never generate + such address. + + Signed-off-by: Michal Privoznik + Tested-by: Daniel Henrique Barboza + Reviewed-by: Jim Fehlig + +Index: libvirt-5.2.0/tests/qemuhotplugtest.c +=================================================================== +--- libvirt-5.2.0.orig/tests/qemuhotplugtest.c ++++ libvirt-5.2.0/tests/qemuhotplugtest.c +@@ -715,7 +715,7 @@ mymain(void) + "device_del", QMP_OK, + "human-monitor-command", HMP("")); + DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", false, false, +- "device_del", QMP_DEVICE_DELETED("scsi3-0-5-7") QMP_OK, ++ "device_del", QMP_DEVICE_DELETED("scsi3-0-5-6") QMP_OK, + "human-monitor-command", HMP("")); + + DO_TEST_ATTACH("base-live", "qemu-agent", false, true, +Index: libvirt-5.2.0/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-2.xml +=================================================================== +--- libvirt-5.2.0.orig/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-2.xml ++++ libvirt-5.2.0/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-2.xml +@@ -2,7 +2,7 @@ + + + +-
++
+ + + +Index: libvirt-5.2.0/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml +=================================================================== +--- libvirt-5.2.0.orig/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml ++++ libvirt-5.2.0/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml +@@ -26,8 +26,8 @@ + + + +- +-
++ ++
+ + + diff --git a/libvirt.changes b/libvirt.changes index 0a1132c..cbd6e1c 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Apr 19 17:06:42 UTC 2019 - James Fehlig + +- qemu: fix CDROM media change when using virDomainAttachDevice + 89237d53-conf-expose-virDomainSCSIDriveAddressIsUsed.patch, + ee2c5ef3-test-scsi-disk.patch, + ddc72f99-qemu-check-dup-drive-address.patch, + 22dc3e94-revert-f1d65853.patch + boo#1132127 + ------------------------------------------------------------------- Thu Apr 11 23:00:48 UTC 2019 - James Fehlig diff --git a/libvirt.spec b/libvirt.spec index ce8460b..78d9f7f 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -342,6 +342,10 @@ Patch1: ebe9c6ea-qemu-firmware-dirent.patch Patch2: 2a07c990-api-CVE-2019-3886.patch Patch3: ae076bb4-remote-CVE-2019-3886.patch Patch4: f66f70ac-snapshot-fix-use-after-free.patch +Patch5: 89237d53-conf-expose-virDomainSCSIDriveAddressIsUsed.patch +Patch6: ee2c5ef3-test-scsi-disk.patch +Patch7: ddc72f99-qemu-check-dup-drive-address.patch +Patch8: 22dc3e94-revert-f1d65853.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch @@ -880,6 +884,10 @@ libvirt plugin for NSS for translating domain names into IP addresses. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 %patch100 -p1 %patch101 -p1 %patch150 -p1