|
|
7a3408 |
From fbced70807b7564359803a3877fa796c90b32f9f Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <fbced70807b7564359803a3877fa796c90b32f9f@dist-git>
|
|
|
7a3408 |
From: John Ferlan <jferlan@redhat.com>
|
|
|
7a3408 |
Date: Thu, 9 Jul 2015 08:45:36 -0400
|
|
|
7a3408 |
Subject: [PATCH] conf: Don't allow duplicated target names regardless of bus
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1142631
|
|
|
7a3408 |
|
|
|
7a3408 |
Commit id 'e0e290552' added a check to determine if the same bus
|
|
|
7a3408 |
had the same target value. It seems that's not quite good enough
|
|
|
7a3408 |
as the check should check the target name value regardless of bus type.
|
|
|
7a3408 |
|
|
|
7a3408 |
Also added a DO_TEST_DIFFERENT to exhibit the issue
|
|
|
7a3408 |
|
|
|
7a3408 |
(cherry picked from commit 2e09729b1c1cc0096be4edd2d939bf1044aec506)
|
|
|
7a3408 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/conf/domain_conf.c | 3 +-
|
|
|
7a3408 |
.../qemuxml2argv-disk-same-targets.xml | 35 ++++++++++++++++++++++
|
|
|
7a3408 |
tests/qemuxml2argvtest.c | 3 ++
|
|
|
7a3408 |
3 files changed, 39 insertions(+), 2 deletions(-)
|
|
|
7a3408 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
7a3408 |
index 006e04e..f3416cf 100644
|
|
|
7a3408 |
--- a/src/conf/domain_conf.c
|
|
|
7a3408 |
+++ b/src/conf/domain_conf.c
|
|
|
7a3408 |
@@ -12656,8 +12656,7 @@ virDomainDiskDefDstDuplicates(virDomainDefPtr def)
|
|
|
7a3408 |
|
|
|
7a3408 |
for (i = 1; i < def->ndisks; i++) {
|
|
|
7a3408 |
for (j = 0; j < i; j++) {
|
|
|
7a3408 |
- if (def->disks[i]->bus == def->disks[j]->bus &&
|
|
|
7a3408 |
- STREQ(def->disks[i]->dst, def->disks[j]->dst)) {
|
|
|
7a3408 |
+ if (STREQ(def->disks[i]->dst, def->disks[j]->dst)) {
|
|
|
7a3408 |
virReportError(VIR_ERR_XML_ERROR,
|
|
|
7a3408 |
_("target '%s' duplicated for disk sources "
|
|
|
7a3408 |
"'%s' and '%s'"),
|
|
|
7a3408 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml
|
|
|
7a3408 |
new file mode 100644
|
|
|
7a3408 |
index 0000000..3276ce5
|
|
|
7a3408 |
--- /dev/null
|
|
|
7a3408 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml
|
|
|
7a3408 |
@@ -0,0 +1,35 @@
|
|
|
7a3408 |
+<domain type='qemu'>
|
|
|
7a3408 |
+ <name>QEMUGuest1</name>
|
|
|
7a3408 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
7a3408 |
+ <memory unit='KiB'>219136</memory>
|
|
|
7a3408 |
+ <currentMemory unit='KiB'>219136</currentMemory>
|
|
|
7a3408 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
7a3408 |
+ <os>
|
|
|
7a3408 |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
7a3408 |
+ <boot dev='hd'/>
|
|
|
7a3408 |
+ </os>
|
|
|
7a3408 |
+ <clock offset='utc'/>
|
|
|
7a3408 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
7a3408 |
+ <on_reboot>restart</on_reboot>
|
|
|
7a3408 |
+ <on_crash>destroy</on_crash>
|
|
|
7a3408 |
+ <devices>
|
|
|
7a3408 |
+ <emulator>/usr/bin/qemu</emulator>
|
|
|
7a3408 |
+ <disk type='block' device='disk'>
|
|
|
7a3408 |
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
7a3408 |
+ <target dev='hda' bus='ide'/>
|
|
|
7a3408 |
+ </disk>
|
|
|
7a3408 |
+ <disk type='file' device='disk'>
|
|
|
7a3408 |
+ <source file='/tmp/usbdisk.img'/>
|
|
|
7a3408 |
+ <target dev='sda' bus='usb'/>
|
|
|
7a3408 |
+ </disk>
|
|
|
7a3408 |
+ <disk type='file' device='disk'>
|
|
|
7a3408 |
+ <source file='/tmp/idedisk.img'/>
|
|
|
7a3408 |
+ <target dev='sda' bus='ide'/>
|
|
|
7a3408 |
+ </disk>
|
|
|
7a3408 |
+ <disk type='file' device='disk'>
|
|
|
7a3408 |
+ <source file='/tmp/scsidisk.img'/>
|
|
|
7a3408 |
+ <target dev='sda' bus='scsi'/>
|
|
|
7a3408 |
+ </disk>
|
|
|
7a3408 |
+ <memballoon model='virtio'/>
|
|
|
7a3408 |
+ </devices>
|
|
|
7a3408 |
+</domain>
|
|
|
7a3408 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
7a3408 |
index bee6637..4290c06 100644
|
|
|
7a3408 |
--- a/tests/qemuxml2argvtest.c
|
|
|
7a3408 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
7a3408 |
@@ -903,6 +903,9 @@ mymain(void)
|
|
|
7a3408 |
QEMU_CAPS_DEVICE);
|
|
|
7a3408 |
DO_TEST("disk-snapshot",
|
|
|
7a3408 |
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
|
|
|
7a3408 |
+ DO_TEST_FAILURE("disk-same-targets",
|
|
|
7a3408 |
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_SCSI_LSI,
|
|
|
7a3408 |
+ QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
|
|
|
7a3408 |
DO_TEST("event_idx",
|
|
|
7a3408 |
QEMU_CAPS_DRIVE,
|
|
|
7a3408 |
QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.4.5
|
|
|
7a3408 |
|