[libvirt] [PATCH 2/7] tests: qemuxml2xml: Remove testing with allowed format detection

John Ferlan jferlan at redhat.com
Tue Mar 6 13:49:35 UTC 2018



On 03/02/2018 11:56 AM, Peter Krempa wrote:
> Nobody should use format detection due to security implications.

While I cannot disagree technically - would it be "useful" from a code
coverage viewpoint to have just "one" do the allowDiskFormatProbing
assignment similar to how various *TLS assignments are done in the
qemuxml2argvtest.c?  With the appropriate comment regarding the security
implications of format testing. Doesn't matter which one - just choose
one and don't have the output file altered. Of course that'll be the
*one* test that everyone copies to create their xml2xml tests ;-)

Might be useful to note in the commit message that disabling resulted in
(I assume) default output of "<driver name='qemu' type='raw'/>" being
added to outputs for disks and "<format type='raw'/>" for mirrors... All
the input files that changed are just targets of links for output files.

> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  tests/qemuxml2argvdata/disk-drive-detect-zeroes.xml                | 2 +-
>  tests/qemuxml2argvdata/hugepages-memaccess.xml                     | 1 +
>  tests/qemuxml2argvdata/hugepages-memaccess2.xml                    | 1 +
>  tests/qemuxml2argvdata/hugepages-pages4.xml                        | 1 +
>  tests/qemuxml2argvdata/hugepages-pages5.xml                        | 1 +
>  tests/qemuxml2argvdata/hugepages-pages6.xml                        | 1 +
>  tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml            | 1 +
>  tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml             | 1 +
>  tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml                   | 1 +
>  tests/qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.xml        | 1 +
>  tests/qemuxml2xmloutdata/aarch64-aavmf-virtio-mmio.xml             | 1 +
>  tests/qemuxml2xmloutdata/aarch64-virtio-pci-default.xml            | 1 +
>  tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.xml   | 1 +
>  tests/qemuxml2xmloutdata/autoindex.xml                             | 1 +
>  tests/qemuxml2xmloutdata/balloon-device-auto.xml                   | 1 +
>  tests/qemuxml2xmloutdata/balloon-device-period.xml                 | 1 +
>  tests/qemuxml2xmloutdata/bios-nvram-os-interleave.xml              | 1 +
>  tests/qemuxml2xmloutdata/bios-nvram.xml                            | 1 +
>  tests/qemuxml2xmloutdata/blkiotune-device.xml                      | 1 +
>  tests/qemuxml2xmloutdata/blkiotune.xml                             | 1 +
>  tests/qemuxml2xmloutdata/boot-menu-disable-with-timeout.xml        | 1 +
>  tests/qemuxml2xmloutdata/boot-menu-disable.xml                     | 1 +
>  tests/qemuxml2xmloutdata/boot-menu-enable-with-timeout.xml         | 1 +
>  tests/qemuxml2xmloutdata/boot-multi.xml                            | 1 +
>  tests/qemuxml2xmloutdata/boot-order.xml                            | 2 ++
>  tests/qemuxml2xmloutdata/channel-guestfwd.xml                      | 1 +
>  tests/qemuxml2xmloutdata/channel-virtio-auto.xml                   | 1 +
>  tests/qemuxml2xmloutdata/channel-virtio-state-active.xml           | 1 +
>  tests/qemuxml2xmloutdata/channel-virtio-state-inactive.xml         | 1 +
>  tests/qemuxml2xmloutdata/channel-virtio.xml                        | 1 +
>  tests/qemuxml2xmloutdata/clock-catchup.xml                         | 1 +
>  tests/qemuxml2xmloutdata/console-compat-auto.xml                   | 1 +
>  tests/qemuxml2xmloutdata/console-virtio-many.xml                   | 1 +
>  tests/qemuxml2xmloutdata/console-virtio.xml                        | 1 +
>  tests/qemuxml2xmloutdata/cpu-host-passthrough-features.xml         | 1 +
>  tests/qemuxml2xmloutdata/cputune-iothreads.xml                     | 1 +
>  tests/qemuxml2xmloutdata/cputune-iothreadsched-zeropriority.xml    | 1 +
>  tests/qemuxml2xmloutdata/cputune-iothreadsched.xml                 | 1 +
>  tests/qemuxml2xmloutdata/cputune-zero-shares.xml                   | 1 +
>  tests/qemuxml2xmloutdata/cputune.xml                               | 1 +
>  tests/qemuxml2xmloutdata/disk-drive-copy-on-read.xml               | 2 +-
>  tests/qemuxml2xmloutdata/disk-drive-discard.xml                    | 2 +-
>  tests/qemuxml2xmloutdata/disk-mirror-active.xml                    | 5 +++++
>  tests/qemuxml2xmloutdata/disk-mirror-inactive.xml                  | 4 ++++
>  tests/qemuxml2xmloutdata/disk-mirror-old-inactive.xml              | 4 ++++
>  tests/qemuxml2xmloutdata/disk-mirror-old.xml                       | 7 ++++++-
>  tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml                 | 2 ++
>  tests/qemuxml2xmloutdata/disk-scsi-device.xml                      | 2 ++
>  tests/qemuxml2xmloutdata/disk-scsi-disk-vpd.xml                    | 2 ++
>  tests/qemuxml2xmloutdata/disk-scsi-lun-passthrough-sgio.xml        | 2 ++
>  tests/qemuxml2xmloutdata/disk-scsi-megasas.xml                     | 2 ++
>  tests/qemuxml2xmloutdata/disk-scsi-mptsas1068.xml                  | 2 ++
>  tests/qemuxml2xmloutdata/disk-scsi-virtio-scsi.xml                 | 2 ++
>  tests/qemuxml2xmloutdata/disk-scsi-vscsi.xml                       | 2 ++
>  tests/qemuxml2xmloutdata/disk-serial.xml                           | 3 +++
>  tests/qemuxml2xmloutdata/disk-source-pool-mode.xml                 | 4 ++++
>  tests/qemuxml2xmloutdata/disk-source-pool.xml                      | 2 ++
>  tests/qemuxml2xmloutdata/disk-usb-device.xml                       | 2 ++
>  tests/qemuxml2xmloutdata/disk-virtio-scsi-cmd_per_lun.xml          | 1 +
>  tests/qemuxml2xmloutdata/disk-virtio-scsi-ioeventfd.xml            | 1 +
>  tests/qemuxml2xmloutdata/disk-virtio-scsi-max_sectors.xml          | 1 +
>  tests/qemuxml2xmloutdata/disk-virtio-scsi-num_queues.xml           | 1 +
>  tests/qemuxml2xmloutdata/graphics-listen-network.xml               | 1 +
>  tests/qemuxml2xmloutdata/graphics-listen-network2.xml              | 1 +
>  tests/qemuxml2xmloutdata/graphics-spice-compression.xml            | 1 +
>  tests/qemuxml2xmloutdata/graphics-spice-qxl-vga.xml                | 1 +
>  tests/qemuxml2xmloutdata/graphics-spice.xml                        | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-autogen-address.xml          | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-large-unit.xml               | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi-auth.xml           | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml                | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml                      | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml                    | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml                 | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml                     | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-shareable.xml                | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-ccw.xml           | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pci.xml           | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi-auth.xml        | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi.xml             | 1 +
>  tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml              | 1 +
>  tests/qemuxml2xmloutdata/hostdev-vfio.xml                          | 1 +
>  tests/qemuxml2xmloutdata/hugepages-pages.xml                       | 1 +
>  tests/qemuxml2xmloutdata/hugepages-pages2.xml                      | 1 +
>  tests/qemuxml2xmloutdata/hugepages-pages3.xml                      | 1 +
>  tests/qemuxml2xmloutdata/hugepages-shared.xml                      | 1 +
>  tests/qemuxml2xmloutdata/hugepages.xml                             | 1 +
>  tests/qemuxml2xmloutdata/lease.xml                                 | 2 ++
>  .../machine-loadparm-multiple-disks-nets-s390.xml                  | 2 ++
>  tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml                   | 1 +
>  tests/qemuxml2xmloutdata/memory-hotplug.xml                        | 1 +
>  tests/qemuxml2xmloutdata/memtune-unlimited.xml                     | 1 +
>  tests/qemuxml2xmloutdata/memtune.xml                               | 1 +
>  tests/qemuxml2xmloutdata/metadata-duplicate.xml                    | 1 +
>  tests/qemuxml2xmloutdata/metadata.xml                              | 1 +
>  tests/qemuxml2xmloutdata/minimal.xml                               | 1 +
>  tests/qemuxml2xmloutdata/net-hostdev-vfio.xml                      | 1 +
>  tests/qemuxml2xmloutdata/net-hostdev.xml                           | 1 +
>  tests/qemuxml2xmloutdata/net-midonet.xml                           | 1 +
>  tests/qemuxml2xmloutdata/net-openvswitch.xml                       | 1 +
>  tests/qemuxml2xmloutdata/net-udp.xml                               | 1 +
>  tests/qemuxml2xmloutdata/net-virtio-device.xml                     | 1 +
>  tests/qemuxml2xmloutdata/net-virtio-disable-offloads.xml           | 1 +
>  tests/qemuxml2xmloutdata/net-virtio-network-portgroup.xml          | 1 +
>  tests/qemuxml2xmloutdata/net-virtio-rxtxqueuesize.xml              | 1 +
>  tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml         | 1 +
>  .../numad-auto-memory-vcpu-no-cpuset-and-placement.xml             | 1 +
>  tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml           | 1 +
>  tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml         | 1 +
>  tests/qemuxml2xmloutdata/panic-isa.xml                             | 1 +
>  tests/qemuxml2xmloutdata/panic-no-address.xml                      | 1 +
>  tests/qemuxml2xmloutdata/panic.xml                                 | 1 +
>  tests/qemuxml2xmloutdata/pci-rom.xml                               | 1 +
>  tests/qemuxml2xmloutdata/pci-serial-dev-chardev.xml                | 1 +
>  tests/qemuxml2xmloutdata/pcie-expander-bus.xml                     | 1 +
>  tests/qemuxml2xmloutdata/pcie-root-port.xml                        | 1 +
>  tests/qemuxml2xmloutdata/pcie-switch-downstream-port.xml           | 1 +
>  tests/qemuxml2xmloutdata/pcie-switch-upstream-port.xml             | 1 +
>  tests/qemuxml2xmloutdata/pcihole64-q35.xml                         | 1 +
>  tests/qemuxml2xmloutdata/q35-pcie-autoadd.xml                      | 1 +
>  tests/qemuxml2xmloutdata/q35-pcie.xml                              | 1 +
>  tests/qemuxml2xmloutdata/q35-usb2-multi.xml                        | 1 +
>  tests/qemuxml2xmloutdata/q35-usb2-reorder.xml                      | 1 +
>  tests/qemuxml2xmloutdata/q35-usb2.xml                              | 1 +
>  tests/qemuxml2xmloutdata/q35-virtio-pci.xml                        | 1 +
>  tests/qemuxml2xmloutdata/q35.xml                                   | 1 +
>  tests/qemuxml2xmloutdata/seclabel-dac-none.xml                     | 1 +
>  tests/qemuxml2xmloutdata/seclabel-device-multiple.xml              | 1 +
>  tests/qemuxml2xmloutdata/seclabel-dynamic-baselabel.xml            | 1 +
>  tests/qemuxml2xmloutdata/seclabel-dynamic-labelskip.xml            | 1 +
>  tests/qemuxml2xmloutdata/seclabel-dynamic-none.xml                 | 1 +
>  tests/qemuxml2xmloutdata/seclabel-dynamic-override.xml             | 2 ++
>  tests/qemuxml2xmloutdata/seclabel-dynamic-relabel.xml              | 1 +
>  tests/qemuxml2xmloutdata/seclabel-none.xml                         | 1 +
>  tests/qemuxml2xmloutdata/seclabel-static-labelskip.xml             | 1 +
>  tests/qemuxml2xmloutdata/seclabel-static.xml                       | 1 +
>  tests/qemuxml2xmloutdata/serial-spiceport-nospice.xml              | 1 +
>  tests/qemuxml2xmloutdata/serial-spiceport.xml                      | 1 +
>  tests/qemuxml2xmloutdata/serial-target-port-auto.xml               | 1 +
>  tests/qemuxml2xmloutdata/serial-tcp-tlsx509-chardev.xml            | 1 +
>  tests/qemuxml2xmloutdata/smbios-multiple-type2.xml                 | 1 +
>  tests/qemuxml2xmloutdata/smbios.xml                                | 1 +
>  tests/qemuxml2xmloutdata/sound-device.xml                          | 1 +
>  tests/qemuxml2xmloutdata/video-qxl-heads.xml                       | 1 +
>  tests/qemuxml2xmloutdata/video-qxl-noheads.xml                     | 1 +
>  tests/qemuxml2xmloutdata/vmcoreinfo.xml                            | 1 +
>  tests/qemuxml2xmltest.c                                            | 3 ---
>  147 files changed, 180 insertions(+), 7 deletions(-)
> 

[...]

> diff --git a/tests/qemuxml2xmloutdata/disk-mirror-old.xml b/tests/qemuxml2xmloutdata/disk-mirror-old.xml
> index e390bc02f2..f8a885aec8 100644
> --- a/tests/qemuxml2xmloutdata/disk-mirror-old.xml
> +++ b/tests/qemuxml2xmloutdata/disk-mirror-old.xml
> @@ -15,15 +15,18 @@
>    <devices>
>      <emulator>/usr/bin/qemu-system-i686</emulator>
>      <disk type='block' device='disk'>
> +      <driver name='qemu' type='raw'/>
>        <source dev='/dev/HostVG/QEMUGuest1'/>
>        <backingStore/>
> -      <mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' job='copy' ready='yes'>
> +      <mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' format='raw' job='copy' ready='yes'>
> +        <format type='raw'/>

Interesting that "format type='raw'" essentially appears twice...

Does this point out a bug in virDomainDiskDefFormat when printing
<mirror...> as formatStr is printed twice.


John

>          <source file='/dev/HostVG/QEMUGuest1Copy'/>
>        </mirror>
>        <target dev='hda' bus='ide'/>
>        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>      </disk>
>      <disk type='block' device='cdrom'>
> +      <driver name='qemu' type='raw'/>
>        <source dev='/dev/HostVG/QEMUGuest2'/>
>        <backingStore/>
>        <target dev='hdc' bus='ide'/>
> @@ -31,6 +34,7 @@
>        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
>      </disk>
>      <disk type='file' device='disk'>
> +      <driver name='qemu' type='raw'/>
>        <source file='/tmp/data.img'/>
>        <backingStore/>
>        <mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
> @@ -41,6 +45,7 @@
>        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
>      </disk>
>      <disk type='file' device='disk'>
> +      <driver name='qemu' type='raw'/>
>        <source file='/tmp/logs.img'/>
>        <backingStore/>
>        <target dev='vdb' bus='virtio'/>

[...]




More information about the libvir-list mailing list