[libvirt] [PATCH] tests: Remove caps from DO_TEST_PARSE_ERROR() calls

Peter Krempa pkrempa at redhat.com
Wed Jan 31 08:38:00 UTC 2018


On Tue, Jan 30, 2018 at 19:10:06 +0100, Andrea Bolognani wrote:
> The lack of certain capabilities is going to cause errors pretty
> much exclusively when building the QEMU command line, because we
> purposefully leave such checks to the very last moments before
> starting a guest; so it doesn't make much sense to pass QEMU
> capabilities to DO_TEST_PARSE_ERROR() call which are supposed,
> as the name implies, to result in much earlier error.

This is a pretty strong statement which is not entirely true. Capability
bits may be also used in the post-parse and validation callbacks. Most
of the checks that the command line can be built are still in the
command line formatter but that's not the rule

> The only exception is the "cpu-hotplug-granularity" test, due
> to the fact that the checks we want to fail are skipped entirely
> if the relevant QEMU feature is not available.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  tests/qemuxml2argvtest.c | 184 +++++++++++++----------------------------------
>  1 file changed, 51 insertions(+), 133 deletions(-)
> 
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index c8739909d..2df778853 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c

[...]

> @@ -1037,17 +1034,10 @@ mymain(void)
>              QEMU_CAPS_DRIVE_DISCARD,
>              QEMU_CAPS_DRIVE_DETECT_ZEROES);
>      DO_TEST("disk-snapshot", NONE);
> -    DO_TEST_PARSE_ERROR("disk-same-targets",
> -                        QEMU_CAPS_SCSI_LSI,
> -                        QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);


So this is not quite equivalent. Here's a diff of error messages prior
and after your patch:

$ diff -u stderr stderr2
--- stderr	2018-01-31 09:34:37.295273384 +0100
+++ stderr2	2018-01-31 09:34:39.241273208 +0100
@@ -359,7 +359,7 @@
 176) QEMU XML-2-ARGV disk-drive-detect-zeroes                          ... OK
 177) QEMU XML-2-ARGV disk-snapshot                                     ... OK
 178) QEMU XML-2-ARGV disk-same-targets                                 ... Got expected error:
- error : virDomainDiskDefCheckDuplicateInfo:28528 : XML error: target 'sda' duplicated for disk sources '/tmp/idedisk.img' and '/tmp/usbdisk.img'
+ error : qemuDomainSetSCSIControllerModel:100 : internal error: Unable to determine model for scsi controller
 OK
 179) QEMU XML-2-ARGV disk-drive-address-conflict                       ... Got expected error:
  error : virDomainDefCheckDuplicateDriveAddresses:5764 : unsupported configuration: Found duplicate drive address for disk with target name 'sda' controller='0' bus='0' target='0' unit='0'
@@ -368,7 +368,7 @@
  error : virDomainDiskDefAssignAddress:7912 : unsupported configuration: using disk target name 'sda' conflicts with SCSI host device address controller='0' bus='0' target='0' unit='0
 OK
 181) QEMU XML-2-ARGV hostdevs-drive-address-conflict                   ... Got expected error:
- error : virDomainDefCheckDuplicateDriveAddresses:5805 : unsupported configuration: SCSI host address controller='0' bus='0' target='0' unit='0' in use by another SCSI host device
+ error : qemuDomainSetSCSIControllerModel:62 : unsupported configuration: This QEMU doesn't support virtio scsi controller
 OK
 182) QEMU XML-2-ARGV event_idx                                         ... OK
 183) QEMU XML-2-ARGV virtio-lun                                        ... OK
@@ -387,8 +387,7 @@
  error : virDomainDiskDefValidate:5193 : unsupported configuration: Invalid address type 'pci' for the disk 'sda' with the bus type 'sata'
 OK
 189) QEMU XML-2-ARGV disk-scsi-incompatible-address                    ... Got expected error:
- warning : qemuDomainCollectPCIAddress:1242 : qemuDomainDeviceCalculatePCIConnectFlags() thinks that the device with PCI address 0000:00:01.1 should not have a PCI address
- error : virDomainDiskDefValidate:5193 : unsupported configuration: Invalid address type 'pci' for the disk 'sda' with the bus type 'scsi'
+ error : qemuDomainSetSCSIControllerModel:62 : unsupported configuration: This QEMU doesn't support virtio scsi controller
 OK
 190) QEMU XML-2-ARGV graphics-vnc                                      ... OK
 191) QEMU XML-2-ARGV graphics-vnc-socket                               ... OK
@@ -896,7 +895,7 @@
 OK
 560) QEMU XML-2-ARGV s390-panic-missing                                ... OK
 561) QEMU XML-2-ARGV s390-no-parallel                                  ... Got expected error:
- error : qemuDomainChrDefValidate:3588 : unsupported configuration: parallel ports are not supported
+ error : virDomainPCIAddressGetNextAddr:805 : XML error: No PCI buses available
 OK
 562) QEMU XML-2-ARGV s390-serial                                       ... OK
 563) QEMU XML-2-ARGV s390-serial-2                                     ... OK

> @@ -2915,6 +2830,9 @@ mymain(void)
>              QEMU_CAPS_DEVICE_INTEL_IOMMU);
>  
>      DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
> +    /* The _QUERY_HOTPLUGGABLE_CPUS capability is needed here because, if
> +     * not present, libvirt will not perform the vCPU hotplug granularity
> +     * validation and the test will pass rather than failing */

This error message is spurious. There is a good reason to have
capability bits for some tests and I don't think it needs to be
explained.

>      DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
>                          QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180131/5a65e6fe/attachment-0001.sig>


More information about the libvir-list mailing list