Accepting request 696099 from home:jfehlig:branches:Virtualization
- 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 OBS-URL: https://build.opensuse.org/request/show/696099 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=748
This commit is contained in:
parent
376a708d02
commit
25a1844db7
@ -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;
|
||||
|
40
22dc3e94-revert-f1d65853.patch
Normal file
40
22dc3e94-revert-f1d65853.patch
Normal file
@ -0,0 +1,40 @@
|
||||
commit 22dc3e94c24b4d9a6c28beda91b9b283eb9b0251
|
||||
Author: Michal Privoznik <mprivozn@redhat.com>
|
||||
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 <mprivozn@redhat.com>
|
||||
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
||||
|
||||
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 &&
|
54
89237d53-conf-expose-virDomainSCSIDriveAddressIsUsed.patch
Normal file
54
89237d53-conf-expose-virDomainSCSIDriveAddressIsUsed.patch
Normal file
@ -0,0 +1,54 @@
|
||||
commit 89237d534f0fe950d06a2081089154160c6c2224
|
||||
Author: Michal Privoznik <mprivozn@redhat.com>
|
||||
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 <mprivozn@redhat.com>
|
||||
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
||||
|
||||
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;
|
30
ddc72f99-qemu-check-dup-drive-address.patch
Normal file
30
ddc72f99-qemu-check-dup-drive-address.patch
Normal file
@ -0,0 +1,30 @@
|
||||
commit ddc72f99027b063feaf34e5fda89916b6b2c8943
|
||||
Author: Michal Privoznik <mprivozn@redhat.com>
|
||||
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 <mprivozn@redhat.com>
|
||||
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
||||
|
||||
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.
|
56
ee2c5ef3-test-scsi-disk.patch
Normal file
56
ee2c5ef3-test-scsi-disk.patch
Normal file
@ -0,0 +1,56 @@
|
||||
commit ee2c5ef39fd91345893904433c6f458685543af5
|
||||
Author: Michal Privoznik <mprivozn@redhat.com>
|
||||
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 <mprivozn@redhat.com>
|
||||
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
||||
|
||||
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 @@
|
||||
<driver name='qemu' type='raw' cache='none'/>
|
||||
<source file='/dev/null'/>
|
||||
<target dev='sdf' bus='scsi'/>
|
||||
- <address type='drive' controller='3' bus='0' target='5' unit='7'/>
|
||||
+ <address type='drive' controller='3' bus='0' target='5' unit='6'/>
|
||||
<readonly/>
|
||||
<shareable/>
|
||||
</disk>
|
||||
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 @@
|
||||
<target dev='sdf' bus='scsi'/>
|
||||
<readonly/>
|
||||
<shareable/>
|
||||
- <alias name='scsi3-0-5-7'/>
|
||||
- <address type='drive' controller='3' bus='0' target='5' unit='7'/>
|
||||
+ <alias name='scsi3-0-5-6'/>
|
||||
+ <address type='drive' controller='3' bus='0' target='5' unit='6'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 19 17:06:42 UTC 2019 - James Fehlig <jfehlig@suse.com>
|
||||
|
||||
- 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 <jfehlig@suse.com>
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user