Re: [PATCH] conf: Don't allow duplicated targets regardless of bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ping?

Tks -

John

On 06/18/2015 04:12 PM, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1142631
> 
> Commit id 'e0e290552' added a check to determine if the same bus
> had the same target value.  It seems that's not quite good enough
> as the check should check the target name value regardless of bus type.
> 
> Also added a DO_TEST_DIFFERENT to exhibit the issue
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c                             |  3 +-
>  .../qemuxml2argv-disk-same-targets.xml             | 35 ++++++++++++++++++++++
>  tests/qemuxml2argvtest.c                           |  3 ++
>  3 files changed, 39 insertions(+), 2 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b10f6cd..7855bcb 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -12590,8 +12590,7 @@ virDomainDiskDefDstDuplicates(virDomainDefPtr def)
>  
>      for (i = 1; i < def->ndisks; i++) {
>          for (j = 0; j < i; j++) {
> -            if (def->disks[i]->bus == def->disks[j]->bus &&
> -                STREQ(def->disks[i]->dst, def->disks[j]->dst)) {
> +            if (STREQ(def->disks[i]->dst, def->disks[j]->dst)) {
>                  virReportError(VIR_ERR_XML_ERROR,
>                                 _("target '%s' duplicated for disk sources "
>                                   "'%s' and '%s'"),
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml
> new file mode 100644
> index 0000000..3276ce5
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-same-targets.xml
> @@ -0,0 +1,35 @@
> +<domain type='qemu'>
> +  <name>QEMUGuest1</name>
> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +  <memory unit='KiB'>219136</memory>
> +  <currentMemory unit='KiB'>219136</currentMemory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch='i686' machine='pc'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/bin/qemu</emulator>
> +    <disk type='block' device='disk'>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='hda' bus='ide'/>
> +    </disk>
> +    <disk type='file' device='disk'>
> +      <source file='/tmp/usbdisk.img'/>
> +      <target dev='sda' bus='usb'/>
> +    </disk>
> +    <disk type='file' device='disk'>
> +      <source file='/tmp/idedisk.img'/>
> +      <target dev='sda' bus='ide'/>
> +    </disk>
> +    <disk type='file' device='disk'>
> +      <source file='/tmp/scsidisk.img'/>
> +      <target dev='sda' bus='scsi'/>
> +    </disk>
> +    <memballoon model='virtio'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index be82dd2..b066681 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -882,6 +882,9 @@ mymain(void)
>              QEMU_CAPS_DEVICE);
>      DO_TEST("disk-snapshot",
>              QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
> +    DO_TEST_FAILURE("disk-same-targets",
> +                    QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_SCSI_LSI,
> +                    QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
>      DO_TEST("event_idx",
>              QEMU_CAPS_DRIVE,
>              QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]