[libvirt] [PULL 1/8] qemu-nbd: Deprecate qemu-nbd --partition
The existing qemu-nbd --partition code claims to handle logical partitions up to 8, since its introduction in 2008 (commit 7a5ca86). However, the implementation is bogus (actual MBR logical partitions form a sort of linked list, with one partition per extended table entry, rather than four logical partitions in a single extended table), making the code unlikely to work for anything beyond -P5 on actual guest images. What's more, the code does not support GPT partitions, which are becoming more popular, and maintaining device subsetting in both NBD and the raw device is unnecessary duplication of effort (even if it is not too difficult). Note that obtaining the offsets of a partition (MBR or GPT) can be learned by using 'qemu-nbd -c /dev/nbd0 file.qcow2 && sfdisk --dump /dev/nbd0', but by the time you've done that, you might as well just mount /dev/nbd0p1 that the kernel creates for you instead of bothering with qemu exporting a subset. Or, keeping to just user-space code, use nbdkit's partition filter, which has already known both GPT and primary MBR partitions for a while, and was just recently enhanced to support arbitrary logical MBR parititions. Start the clock on the deprecation cycle, with examples of how to accomplish device subsetting without using -P. Signed-off-by: Eric Blake Message-Id: <20190125234837.2272-1-ebl...@redhat.com> Reviewed-by: Richard W.M. Jones Reviewed-by: Stefano Garzarella --- qemu-deprecated.texi | 33 + qemu-nbd.texi| 6 -- qemu-nbd.c | 2 ++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 9cc20b365c5..8a6174df0c1 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -160,3 +160,36 @@ Example of legacy encoding: The above, converted to the current supported format: @code{json:@{"file.driver":"rbd", "file.pool":"rbd", "file.image":"name"@}} + +@section Related binaries + +@subsection qemu-nbd --partition (since 4.0.0) + +The ``qemu-nbd --partition $digit'' code (also spelled @option{-P}) +can only handle MBR partitions, and has never correctly handled +logical partitions beyond partition 5. If you know the offset and +length of the partition (perhaps by using @code{sfdisk} within the +guest), you can achieve the effect of exporting just that subset of +the disk by use of the @option{--image-opts} option with a raw +blockdev using the @code{offset} and @code{size} parameters layered on +top of any other existing blockdev. For example, if partition 1 is +100MiB long starting at 1MiB, the old command: + +@code{qemu-nbd -t -P 1 -f qcow2 file.qcow2} + +can be rewritten as: + +@code{qemu-nbd -t --image-opts driver=raw,offset=1M,size=100M,file.driver=qcow2,file.backing.driver=file,file.backing.filename=file.qcow2} + +Alternatively, the @code{nbdkit} project provides a more powerful +partition filter on top of its nbd plugin, which can be used to select +an arbitrary MBR or GPT partition on top of any other full-image NBD +export. Using this to rewrite the above example results in: + +@code{qemu-nbd -t -k /tmp/sock -f qcow2 file.qcow2 &} +@code{nbdkit -f --filter=partition nbd socket=/tmp/sock partition=1} + +Note that if you are exposing the export via /dev/nbd0, it is easier +to just export the entire image and then mount only /dev/nbd0p1 than +it is to reinvoke @command{qemu-nbd -c /dev/nbd0} limited to just a +subset of the image. diff --git a/qemu-nbd.texi b/qemu-nbd.texi index 386bece4680..d0c51828149 100644 --- a/qemu-nbd.texi +++ b/qemu-nbd.texi @@ -56,8 +56,10 @@ auto-detecting. @item -r, --read-only Export the disk as read-only. @item -P, --partition=@var{num} -Only expose MBR partition @var{num}. Understands physical partitions -1-4 and logical partitions 5-8. +Deprecated: Only expose MBR partition @var{num}. Understands physical +partitions 1-4 and logical partition 5. New code should instead use +@option{--image-opts} with the raw driver wrapping a subset of the +original image. @item -B, --bitmap=@var{name} If @var{filename} has a qcow2 persistent bitmap @var{name}, expose that bitmap via the ``qemu:dirty-bitmap:@var{name}'' context diff --git a/qemu-nbd.c b/qemu-nbd.c index 1f7b2a03f5d..00c07fd27ea 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -787,6 +787,8 @@ int main(int argc, char **argv) flags &= ~BDRV_O_RDWR; break; case 'P': +warn_report("The '-P' option is deprecated; use --image-opts with " +"a raw device wrapper for subset exports instead"); if (qemu_strtoi(optarg, NULL, 0, ) < 0 || partition < 1 || partition > 8) { error_report("Invalid partition '%s'", optarg); -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
Hi Erik, Just to let you know that the error I reported in one of my replies was being caused by one change I forgot to undo. This error here: error : virQEMUCapsNewForBinaryInternal:4687 : internal error: Failed to probe QEMU binary with QMP: libvirt: error : prctl failed to enable 'dac_override' in the AMBIENT set: Operation not permitted was happening because I have commented out this line inside qemu_capabilities.c: --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4519,7 +4519,7 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, "-daemonize", NULL); virCommandAddEnvPassCommon(cmd->cmd); - virCommandClearCaps(cmd->cmd); + // virCommandClearCaps(cmd->cmd); #if WITH_CAPNG /* QEMU might run into permission issues, e.g. /dev/sev (0600), override Thus there is no need to move the PR_CAP_AMBIENT around to prevent the error message. Sorry for any alarms I might have raised there. I'm still experiencing the issue with IPC_LOCK inside the guest though. I'll update here when I have concrete findings about it. Thanks, DHB On 2/4/19 4:26 PM, Daniel Henrique Barboza wrote: Hey Erik, On 2/4/19 8:11 AM, Erik Skultety wrote: On Fri, Feb 01, 2019 at 07:40:36PM -0200, Daniel Henrique Barboza wrote: Update: I've figured it out. The bug here was that, even running as root, I was getting errors like: error : virQEMUCapsNewForBinaryInternal:4687 : internal error: Failed to probe QEMU binary with QMP: libvirt: error : prctl failed to enable 'dac_override' in the AMBIENT set: Operation not permitted Being responsible for the latest changes wrt to capabilities, this error itself is very strange because the prctl man page says the following about EPERM errno: "option is PR_CAP_AMBIENT and arg2 is PR_CAP_AMBIENT_RAISE, but either the capability specified in arg3 is not present in the process's permitted and inheritable capability sets, or the PR_CAP_AMBIENT_LOWER securebit has been set." So I'm wondering how can that be since that prctl call happens after we applied the capabilities we want with capng_apply. Just out of curiosity, what happens if you move the whole PR_CAP_AMBIENT at the very end of virSetUIDGIDWithCaps function? Does it change anything? Moving the code as you suggested got rid of the internal error: --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -1587,27 +1587,6 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, goto cleanup; } -# ifdef PR_CAP_AMBIENT - /* we couldn't do this in the loop earlier above, because the capabilities - * were not applied yet, since in order to add a capability into the AMBIENT - * set, it has to be present in both the PERMITTED and INHERITABLE sets - * (capabilities(7)) - */ - for (i = 0; i <= CAP_LAST_CAP; i++) { - capstr = capng_capability_to_name(i); - - if (capBits & (1ULL << i)) { - if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, i, 0, 0) < 0) { - virReportSystemError(errno, - _("prctl failed to enable '%s' in the " - "AMBIENT set"), - capstr); - goto cleanup; - } - } - } -# endif - /* Set bounding set while we have CAP_SETPCAP. Unfortunately we cannot * do this if we failed to get the capability above, so ignore the * return value. @@ -1630,6 +1609,27 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, goto cleanup; } +# ifdef PR_CAP_AMBIENT + /* we couldn't do this in the loop earlier above, because the capabilities + * were not applied yet, since in order to add a capability into the AMBIENT + * set, it has to be present in both the PERMITTED and INHERITABLE sets + * (capabilities(7)) + */ + for (i = 0; i <= CAP_LAST_CAP; i++) { + capstr = capng_capability_to_name(i); + + if (capBits & (1ULL << i)) { + if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, i, 0, 0) < 0) { + virReportSystemError(errno, + _("prctl failed to enable '%s' in the " + "AMBIENT set"), + capstr); + goto cleanup; + } + } + } +# endif + However, this code still doesn't add IPC_LOCK as capability: index 0d58f1ee57..f4b46abc08 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c +++ b/src/qemu/qemu_capabilities.c @@ -4525,6 +4525,9 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, /* QEMU might run into permission issues, e.g. /dev/sev (0600), override * them just for the purpose of probing */ virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); +
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
Hey Erik, On 2/4/19 8:11 AM, Erik Skultety wrote: On Fri, Feb 01, 2019 at 07:40:36PM -0200, Daniel Henrique Barboza wrote: Update: I've figured it out. The bug here was that, even running as root, I was getting errors like: error : virQEMUCapsNewForBinaryInternal:4687 : internal error: Failed to probe QEMU binary with QMP: libvirt: error : prctl failed to enable 'dac_override' in the AMBIENT set: Operation not permitted Being responsible for the latest changes wrt to capabilities, this error itself is very strange because the prctl man page says the following about EPERM errno: "option is PR_CAP_AMBIENT and arg2 is PR_CAP_AMBIENT_RAISE, but either the capability specified in arg3 is not present in the process's permitted and inheritable capability sets, or the PR_CAP_AMBIENT_LOWER securebit has been set." So I'm wondering how can that be since that prctl call happens after we applied the capabilities we want with capng_apply. Just out of curiosity, what happens if you move the whole PR_CAP_AMBIENT at the very end of virSetUIDGIDWithCaps function? Does it change anything? Moving the code as you suggested got rid of the internal error: --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -1587,27 +1587,6 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, goto cleanup; } -# ifdef PR_CAP_AMBIENT - /* we couldn't do this in the loop earlier above, because the capabilities - * were not applied yet, since in order to add a capability into the AMBIENT - * set, it has to be present in both the PERMITTED and INHERITABLE sets - * (capabilities(7)) - */ - for (i = 0; i <= CAP_LAST_CAP; i++) { - capstr = capng_capability_to_name(i); - - if (capBits & (1ULL << i)) { - if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, i, 0, 0) < 0) { - virReportSystemError(errno, - _("prctl failed to enable '%s' in the " - "AMBIENT set"), - capstr); - goto cleanup; - } - } - } -# endif - /* Set bounding set while we have CAP_SETPCAP. Unfortunately we cannot * do this if we failed to get the capability above, so ignore the * return value. @@ -1630,6 +1609,27 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, goto cleanup; } +# ifdef PR_CAP_AMBIENT + /* we couldn't do this in the loop earlier above, because the capabilities + * were not applied yet, since in order to add a capability into the AMBIENT + * set, it has to be present in both the PERMITTED and INHERITABLE sets + * (capabilities(7)) + */ + for (i = 0; i <= CAP_LAST_CAP; i++) { + capstr = capng_capability_to_name(i); + + if (capBits & (1ULL << i)) { + if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, i, 0, 0) < 0) { + virReportSystemError(errno, + _("prctl failed to enable '%s' in the " + "AMBIENT set"), + capstr); + goto cleanup; + } + } + } +# endif + However, this code still doesn't add IPC_LOCK as capability: index 0d58f1ee57..f4b46abc08 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c +++ b/src/qemu/qemu_capabilities.c @@ -4525,6 +4525,9 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, /* QEMU might run into permission issues, e.g. /dev/sev (0600), override * them just for the purpose of probing */ virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); + virCommandAllowCap(cmd->cmd, CAP_IPC_LOCK); + virCommandAllowCap(cmd->cmd, CAP_IPC_OWNER); + #endif So I am not sure if my mod above is wrong or your suggestion of moving the PR_CAP_AMBIENT code made the warning go away but isn't setting the capabilities at all. I'll investigate it more. DHB Thanks, Erik The reason is that the host has libcap-ng installed. ./configure uses it if available, setting WITH_CAPNG in the code. I am unsure if this has something to do with the libcap-ng configuration in this system I'm using or if there is something missing in the Libvirt code, but the spawned QEMU process isn't inheriting the capabilities it should have. Disabling support of this lib with "--with-capng=no" in autogen.sh and rebuilding Libvirt fixed the problem. I was even able to see more NUMA nodes than I was before using the system libvirt (which is the original bug I am/was investigating). Thanks! On 2/1/19 4:04 PM, Daniel Henrique Barboza wrote: Hi, I'm facing a strange behavior when running Libvirt from source code, latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU guest - which is using VFIO and GPU passthrough - breaks on boot when trying to allocate a DMA window inside KVM. Debugging the code, I've found
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
On 2/4/19 7:48 AM, Christian Ehrhardt wrote: On Mon, Feb 4, 2019 at 9:59 AM Michal Privoznik wrote: On 2/1/19 7:04 PM, Daniel Henrique Barboza wrote: Hi, I'm facing a strange behavior when running Libvirt from source code, latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU guest - which is using VFIO and GPU passthrough - breaks on boot when trying to allocate a DMA window inside KVM. Debugging the code, I've found out that the problem is related to the process not having CAP_IPC_LOCK - at least from the host kernel perspective. This is strange because: - the same VM running directly from QEMU command line works - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) also works FYI Ubuntu's version is build with capng for the cap dropping feature as discussed in this thread. libcap-ng-dev is installed as build dependencies and "--with-capng" is set on all Linux builds. Good to know. "jus disable ligcap-ng support" wasn't a solution that I was going to propose, but with this info I can explain to other people why this isn't viable at all. What am I missing? My understanding on Linux process is that a process running as root should inherit the same capabilities of the user, which includes CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock to it ... right? No. Ideally, you trust libvirt and want it to manage devices on your system thus it needs all the capabilities. But qemu spawn by libvirt should have no capabilities as libvirt set up everything that's needed for qemu to run. But this is hard to get right - qemu changes and so does the capabilities it may require (these depend on domain configuration anyway). Therefore, it is possible to set libvirt so it does not drop capabilities for qemu process - see clear_emulator_capabilities in qemu.conf - but then libvirt can't guarantee that a compromised qemu does no harm. Thanks for the explanation. What I need to do then is to see exactly the capabilities Iam missing from QEMU (aside from IPC_LOCK) and see if we can get Libvirt to set them. Thanks, DHB This corresponds with your finding about ./configure - if there is no libncap-ng found there's no way for libvirt to drop capabilities and thus it doesn't do that. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
On 2/4/19 6:47 AM, Yuval Shaia wrote: On Fri, Feb 01, 2019 at 07:40:36PM -0200, Daniel Henrique Barboza wrote: Update: I've figured it out. The bug here was that, even running as root, I was getting errors like: error : virQEMUCapsNewForBinaryInternal:4687 : internal error: Failed to probe QEMU binary with QMP: libvirt: error : prctl failed to enable 'dac_override' in the AMBIENT set: Operation not permitted The reason is that the host has libcap-ng installed. ./configure uses it if available, setting WITH_CAPNG in the code. I am unsure if this has something to do with the libcap-ng configuration in this system I'm using or if there is something missing in the Libvirt code, but the spawned QEMU process isn't inheriting the capabilities it should have. Disabling support of this lib with "--with-capng=no" in autogen.sh and rebuilding Libvirt fixed the problem. I was even able to see more NUMA nodes than I was before using the system libvirt (which is the original bug I am/was investigating). Thanks! Hey Daniel, I had the same problem with Mellanox RDMA device as backend for pvrdma device where the mlx5 driver also enforces CAP_IPC_LOCK. So at first i use this as a workaround but i knew that it is not a final approach as it makes a wrong use of memory. Anyways, your tip helps so wanted to say thanks! No problem! Thanks for sharing your memoryBacking workaround. DHB Yuval On 2/1/19 4:04 PM, Daniel Henrique Barboza wrote: Hi, I'm facing a strange behavior when running Libvirt from source code, latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU guest - which is using VFIO and GPU passthrough - breaks on boot when trying to allocate a DMA window inside KVM. Debugging the code, I've found out that the problem is related to the process not having CAP_IPC_LOCK - at least from the host kernel perspective. This is strange because: - the same VM running directly from QEMU command line works - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) also works What am I missing? My understanding on Linux process is that a process running as root should inherit the same capabilities of the user, which includes CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock to it ... right? Any help is appreciated. I can provide more details (VM XML for example) if necessary. Thanks! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC] qemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root
On Mon, Feb 04, 2019 at 04:26:02PM +0100, Peter Krempa wrote: > It will not work. This breaks qemu capabilities probing as a user. > --- > src/qemu/qemu_capabilities.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c > index 7ed5f94803..81ef0357e7 100644 > --- a/src/qemu/qemu_capabilities.c > +++ b/src/qemu/qemu_capabilities.c > @@ -4524,7 +4524,8 @@ > virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, > #if WITH_CAPNG > /* QEMU might run into permission issues, e.g. /dev/sev (0600), override > * them just for the purpose of probing */ > -virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); > +if (geteuid() == 0) > +virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); This should be enough of a fix with the current code base as it won't clash with the other two CAP_SYS_RAWIO and CAP_NET_ADMIN which should still fail when used with the session daemon as expected. Reviewed-by: Erik Skultety -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 30/32] qemu: caps: Introduce capability for 'device_id' property of 'scsi-disk'
The property allows to control the guest-visible content of the vendor specific designator of the 'Device Identification' page of a SCSI device's VPD (vital product data). QEMU was leaking the id string of -drive as the value if the 'serial' of the disk was not specified. Switching to -blockdev would impose an ABI change. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 1 + 3 files changed, 4 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ec258a971e..290c8c2bdb 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -524,6 +524,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 325 */ "memory-backend-file.pmem", "nvdimm.unarmed", + "scsi-disk.device_id", ); @@ -1157,6 +1158,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsSCSIDisk[] = { { "wwn", QEMU_CAPS_SCSI_DISK_WWN }, { "share-rw", QEMU_CAPS_DISK_SHARE_RW }, { "write-cache", QEMU_CAPS_DISK_WRITE_CACHE }, +{ "device_id", QEMU_CAPS_SCSI_DISK_DEVICE_ID }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsIDEDrive[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 18abd555f4..928cf78e3d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -504,6 +504,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 325 */ QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM, /* -object memory-backend-file,pmem= */ QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed= */ +QEMU_CAPS_SCSI_DISK_DEVICE_ID, /* 'device_id' property of scsi disk */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml index e09d4ca04f..ab7c0dc7f9 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -209,6 +209,7 @@ + 3001050 0 43100758 -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 27/32] qemu: command: Drop formatting of 'media=cdrom' from -drive
For SCSI, IDE, and AHCI cdroms the appropriate device types which select the correct media are used. In qemu there's one other code path that looks at -drive media=cdrom in the XEN pv code. Thankfully we don't support it with qemu (see qemuBuildDiskDeviceStr). All other devices ignore it as the comment states, thus we can drop that code. The test fallout is expectedly only in the test added for uncommon cdrom types. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 9 - .../disk-cdrom-bus-other.x86_64-latest.args | 9 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7c79223812..eaeeb3a05d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1757,15 +1757,6 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR)) qemuBuildDiskFrontendAttributeErrorPolicy(disk, ); - -/* While this is a frontend attribute, it only makes sense to be used when - * legacy -drive is used. In modern qemu the 'ide-cd' or 'scsi-cd' are used. - * virtio and other just ignore the attribute anyways */ -if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM && -disk->bus != VIR_DOMAIN_DISK_BUS_SCSI && -disk->bus != VIR_DOMAIN_DISK_BUS_IDE) -virBufferAddLit(, ",media=cdrom"); - if (disk->src->readonly) virBufferAddLit(, ",readonly=on"); diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args index a64da3edd6..cb7902dfd0 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args @@ -24,15 +24,14 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -no-acpi \ -boot strict=on \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --drive file=/root/boot.iso,format=raw,if=none,id=drive-usb-disk0,media=cdrom,\ -readonly=on \ +-drive file=/root/boot.iso,format=raw,if=none,id=drive-usb-disk0,readonly=on \ -device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0,\ removable=off \ --drive if=none,id=drive-usb-disk1,media=cdrom,readonly=on \ +-drive if=none,id=drive-usb-disk1,readonly=on \ -device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1,\ removable=off \ --drive file=/root/boot2.iso,format=raw,if=sd,index=2,media=cdrom,readonly=on \ --drive if=sd,index=3,media=cdrom,readonly=on \ +-drive file=/root/boot2.iso,format=raw,if=sd,index=2,readonly=on \ +-drive if=sd,index=3,readonly=on \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 28/32] tests: qemuxml2argv: Add a 'serial' value for a SCSI disk
Upcoming addition of a new field will need to make sure that SCSI disk serial is tested as well. Add a case to one of the existing tests. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args | 2 +- tests/qemuxml2argvdata/disk-scsi.xml| 1 + tests/qemuxml2xmloutdata/disk-scsi.xml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args index ac9f3ff02e..68a8b2921d 100644 --- a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args @@ -34,7 +34,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device scsi-hd,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ -drive file=/tmp/scsidisk2.img,format=raw,if=none,id=drive-scsi1-0-0-0 \ -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,\ -id=scsi1-0-0-0 \ +id=scsi1-0-0-0,serial=abcdefghijklmn \ -drive file=/tmp/scsidisk3.img,format=raw,if=none,id=drive-scsi2-0-0-0 \ -device scsi-hd,bus=scsi2.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi2-0-0-0,\ id=scsi2-0-0-0,wwn=0x5000c50015ea71ac \ diff --git a/tests/qemuxml2argvdata/disk-scsi.xml b/tests/qemuxml2argvdata/disk-scsi.xml index 496d8cab39..dda413eb0c 100644 --- a/tests/qemuxml2argvdata/disk-scsi.xml +++ b/tests/qemuxml2argvdata/disk-scsi.xml @@ -28,6 +28,7 @@ + abcdefghijklmn diff --git a/tests/qemuxml2xmloutdata/disk-scsi.xml b/tests/qemuxml2xmloutdata/disk-scsi.xml index 96c0cfec74..9cfff4b14e 100644 --- a/tests/qemuxml2xmloutdata/disk-scsi.xml +++ b/tests/qemuxml2xmloutdata/disk-scsi.xml @@ -30,6 +30,7 @@ + abcdefghijklmn -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 26/32] qemu: Forbid cdroms on virtio bus
Attempting to create an empty virtio-blk drive results into: -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk1,id=virtio-disk1: Device needs media, but drive is empty Attempting to eject media from virtio-blk based drive results into: error: internal error: unable to execute QEMU command 'eject': Device 'drive-virtio-disk0' is not removable Forbid configurations where users would attempt to use cdroms in virtio bus. Test fallout apart from the recently added case contains one more wrong example which is not really relevant to the tested code, thus I've changed the type. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 8 .../disk-cdrom-bus-other.x86_64-latest.args | 7 --- tests/qemuxml2argvdata/disk-cdrom-bus-other.xml | 11 --- .../disk-scsi-disk-vpd-build-error.xml | 2 +- tests/qemuxml2argvdata/pci-autofill-addr.args | 4 ++-- tests/qemuxml2argvdata/pci-autofill-addr.xml| 2 +- tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml | 13 - tests/qemuxml2xmloutdata/pci-autofill-addr.xml | 2 +- 8 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e2b0bd87b4..f27ba9b740 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5078,6 +5078,14 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk, return -1; } +if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM && +disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk type 'virtio' of '%s' does not support ejectable media"), + disk->dst); +return -1; +} + return 0; } diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args index 9dd45133fc..a64da3edd6 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args @@ -31,13 +31,6 @@ removable=off \ -drive if=none,id=drive-usb-disk1,media=cdrom,readonly=on \ -device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1,\ removable=off \ --drive file=/root/boot1.iso,format=raw,if=none,id=drive-virtio-disk0,\ -media=cdrom,readonly=on,cache=none \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\ -id=virtio-disk0,write-cache=on \ --drive if=none,id=drive-virtio-disk1,media=cdrom,readonly=on \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\ -id=virtio-disk1,write-cache=on \ -drive file=/root/boot2.iso,format=raw,if=sd,index=2,media=cdrom,readonly=on \ -drive if=sd,index=3,media=cdrom,readonly=on \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml index 2ed86b0900..a142373afb 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml +++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml @@ -26,17 +26,6 @@ - - - - - - - - - - - diff --git a/tests/qemuxml2argvdata/disk-scsi-disk-vpd-build-error.xml b/tests/qemuxml2argvdata/disk-scsi-disk-vpd-build-error.xml index e116aff114..6c83715be2 100644 --- a/tests/qemuxml2argvdata/disk-scsi-disk-vpd-build-error.xml +++ b/tests/qemuxml2argvdata/disk-scsi-disk-vpd-build-error.xml @@ -14,7 +14,7 @@ destroy /usr/bin/qemu-system-i686 - + SEAGATE diff --git a/tests/qemuxml2argvdata/pci-autofill-addr.args b/tests/qemuxml2argvdata/pci-autofill-addr.args index b546443db3..1508787f8b 100644 --- a/tests/qemuxml2argvdata/pci-autofill-addr.args +++ b/tests/qemuxml2argvdata/pci-autofill-addr.args @@ -22,8 +22,8 @@ server,nowait \ -no-acpi \ -usb \ -drive file=/var/iso/f18kde.iso,format=raw,if=none,id=drive-virtio-disk0,\ -media=cdrom,readonly=on \ +readonly=on \ -device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\ -id=virtio-disk0 \ +id=virtio-disk0,bootindex=1 \ -vga cirrus \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/pci-autofill-addr.xml b/tests/qemuxml2argvdata/pci-autofill-addr.xml index 0d10ec8635..a601c50ab9 100644 --- a/tests/qemuxml2argvdata/pci-autofill-addr.xml +++ b/tests/qemuxml2argvdata/pci-autofill-addr.xml @@ -10,7 +10,7 @@ /usr/bin/qemu-system-x86_64 - + diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml index a9f2806777..e5eb7d6a98 100644 --- a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml +++ b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml @@ -26,19 +26,6 @@ - - -
[libvirt] [PATCH v2 24/32] qemu: command: Use correct type for switch in qemuBuildDiskDeviceStr
Cast disk->bus to proper type and add missing values to the enum so it's more obvious what types are supported. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 77018a2c4b..7c79223812 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1910,7 +1910,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, if (disk->iothread && !qemuCheckIOThreads(def, disk)) goto error; -switch (disk->bus) { +switch ((virDomainDiskBus) disk->bus) { case VIR_DOMAIN_DISK_BUS_IDE: if (disk->info.addr.drive.target != 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2132,6 +2132,10 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virBufferAsprintf(, "floppy,unit=%d", disk->info.addr.drive.unit); break; +case VIR_DOMAIN_DISK_BUS_XEN: +case VIR_DOMAIN_DISK_BUS_UML: +case VIR_DOMAIN_DISK_BUS_SD: +case VIR_DOMAIN_DISK_BUS_LAST: default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported disk bus '%s' with device setup"), bus); -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 09/32] tests: qemuxml: Merge 'ioeventfd' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the process. Signed-off-by: Peter Krempa --- .../controller-virtio-scsi.x86_64-latest.args | 6 ++- .../controller-virtio-scsi.xml| 8 .../disk-virtio-scsi-ioeventfd.args | 28 -- .../disk-virtio-scsi-ioeventfd.xml| 31 tests/qemuxml2argvtest.c | 2 - .../controller-virtio-scsi.xml| 12 +- .../disk-virtio-scsi-ioeventfd.xml| 37 --- tests/qemuxml2xmltest.c | 2 - 8 files changed, 24 insertions(+), 102 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.args delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-virtio-scsi-ioeventfd.xml diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args index 3779e892b6..cf8a497eb7 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args @@ -28,6 +28,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device virtio-scsi-pci,id=scsi1,num_queues=8,bus=pci.0,addr=0x3 \ -device virtio-scsi-pci,id=scsi2,cmd_per_lun=50,bus=pci.0,addr=0x4 \ -device virtio-scsi-pci,id=scsi3,max_sectors=512,bus=pci.0,addr=0x5 \ +-device virtio-scsi-pci,id=scsi4,ioeventfd=on,bus=pci.0,addr=0x6 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ id=scsi0-0-0-0,bootindex=1 \ @@ -40,7 +41,10 @@ id=scsi2-0-0-0 \ -drive file=/dev/HostVG/QEMUGuest4,format=raw,if=none,id=drive-scsi3-0-0-0 \ -device scsi-hd,bus=scsi3.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi3-0-0-0,\ id=scsi3-0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 \ +-drive file=/dev/HostVG/QEMUGuest5,format=raw,if=none,id=drive-scsi4-0-0-0 \ +-device scsi-hd,bus=scsi4.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi4-0-0-0,\ +id=scsi4-0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.xml b/tests/qemuxml2argvdata/controller-virtio-scsi.xml index ebf608d1fd..844e4ad397 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.xml +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.xml @@ -34,6 +34,11 @@ + + + + + @@ -45,6 +50,9 @@ + + + diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.args b/tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.args deleted file mode 100644 index aa7652aa9b..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.args +++ /dev/null @@ -1,28 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 8,sockets=8,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device virtio-scsi-pci,id=scsi0,ioeventfd=on,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ -drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.xml b/tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.xml deleted file mode 100644 index f6fd345595..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-ioeventfd.xml +++ /dev/null @@ -1,31 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 8 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index fbaeb51443..16909dc8a6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1181,8 +1181,6 @@ mymain(void) QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-scsi-vscsi", NONE); -DO_TEST("disk-virtio-scsi-ioeventfd", -QEMU_CAPS_VIRTIO_IOEVENTFD, QEMU_CAPS_VIRTIO_SCSI); DO_TEST_CAPS_LATEST("controller-virtio-scsi");
[libvirt] [PATCH v2 25/32] tests: qemuxml2argv: Add CDROM disks for all untested buses
Add full and empty cdroms on 'usb', 'virtio', and 'sd' bus to have test coverage. Note that this does not guarantee that qemu will accept them. Signed-off-by: Peter Krempa --- .../disk-cdrom-bus-other.x86_64-latest.args | 45 + .../qemuxml2argvdata/disk-cdrom-bus-other.xml | 58 + tests/qemuxml2argvtest.c | 1 + .../disk-cdrom-bus-other.xml | 64 +++ tests/qemuxml2xmltest.c | 1 + 5 files changed, 169 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/disk-cdrom-bus-other.xml create mode 100644 tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args new file mode 100644 index 00..9dd45133fc --- /dev/null +++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args @@ -0,0 +1,45 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-i686 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-drive file=/root/boot.iso,format=raw,if=none,id=drive-usb-disk0,media=cdrom,\ +readonly=on \ +-device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0,\ +removable=off \ +-drive if=none,id=drive-usb-disk1,media=cdrom,readonly=on \ +-device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1,\ +removable=off \ +-drive file=/root/boot1.iso,format=raw,if=none,id=drive-virtio-disk0,\ +media=cdrom,readonly=on,cache=none \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\ +id=virtio-disk0,write-cache=on \ +-drive if=none,id=drive-virtio-disk1,media=cdrom,readonly=on \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\ +id=virtio-disk1,write-cache=on \ +-drive file=/root/boot2.iso,format=raw,if=sd,index=2,media=cdrom,readonly=on \ +-drive if=sd,index=3,media=cdrom,readonly=on \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml new file mode 100644 index 00..2ed86b0900 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml @@ -0,0 +1,58 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + This test is meant for testing CDROMS with buses which don't really support them + 219100 + 219100 + 1 + +hvm + + + + destroy + restart + destroy + +/usr/bin/qemu-system-i686 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b42dd0b28e..dd4f73a5fb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1011,6 +1011,7 @@ mymain(void) DO_TEST("disk-cdrom", NONE); DO_TEST_CAPS_VER("disk-cdrom", "2.12.0"); DO_TEST_CAPS_LATEST("disk-cdrom"); +DO_TEST_CAPS_LATEST("disk-cdrom-bus-other"); DO_TEST("disk-iscsi", NONE); DO_TEST("disk-cdrom-network", QEMU_CAPS_KVM); DO_TEST_CAPS_VER("disk-cdrom-network", "2.12.0"); diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml new file mode 100644 index 00..a9f2806777 --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml @@ -0,0 +1,64 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + This test is meant for testing CDROMS with buses which dont really support them + 219100 + 219100 + 1 + +hvm + + + + destroy + restart + destroy + +/usr/bin/qemu-system-i686 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 370920f926..b38cbd6994 100644 ---
[libvirt] [PATCH v2 21/32] tests: qemuxml2argv: Remove 'disk-virtio-scsi-ccw' test
It's a subset of 'iothreads-virtio-scsi-ccw'. Signed-off-by: Peter Krempa --- .../disk-virtio-scsi-ccw.args | 29 - .../qemuxml2argvdata/disk-virtio-scsi-ccw.xml | 31 --- tests/qemuxml2argvtest.c | 2 -- 3 files changed, 62 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-ccw.args delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-ccw.xml diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-ccw.args b/tests/qemuxml2argvdata/disk-virtio-scsi-ccw.args deleted file mode 100644 index 66d3cbf47a..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-ccw.args +++ /dev/null @@ -1,29 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-s390x \ --name QEMUGuest1 \ --S \ --machine s390-ccw,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --device virtio-scsi-ccw,id=scsi0,devno=fe.0.0001 \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-ccw,devno=fe.0.,drive=drive-virtio-disk0,\ -id=virtio-disk0,bootindex=1 \ --drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-scsi0-0-4-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=4,lun=0,\ -drive=drive-scsi0-0-4-0,id=scsi0-0-4-0 \ --device virtio-balloon-ccw,id=balloon0,devno=fe.0.000a diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-ccw.xml b/tests/qemuxml2argvdata/disk-virtio-scsi-ccw.xml deleted file mode 100644 index 1938b3eaab..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-ccw.xml +++ /dev/null @@ -1,31 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-s390x - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index acdf750102..3c9491982b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1036,8 +1036,6 @@ mymain(void) QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST("disk-virtio-ccw-many", QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390); -DO_TEST("disk-virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI, -QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST("disk-virtio-s390-zpci", QEMU_CAPS_DEVICE_ZPCI, QEMU_CAPS_CCW, -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 16/32] tests: qemu: Merge 'disk-scsi-megasas' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a special test for this controller. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/disk-scsi-megasas.args | 31 - tests/qemuxml2argvdata/disk-scsi-megasas.xml | 35 --- .../disk-scsi.x86_64-latest.args | 6 ++- tests/qemuxml2argvdata/disk-scsi.xml | 6 +++ tests/qemuxml2argvtest.c | 2 - .../qemuxml2xmloutdata/disk-scsi-megasas.xml | 45 --- tests/qemuxml2xmloutdata/disk-scsi.xml| 11 - tests/qemuxml2xmltest.c | 4 +- 8 files changed, 22 insertions(+), 118 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-scsi-megasas.args delete mode 100644 tests/qemuxml2argvdata/disk-scsi-megasas.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-scsi-megasas.xml diff --git a/tests/qemuxml2argvdata/disk-scsi-megasas.args b/tests/qemuxml2argvdata/disk-scsi-megasas.args deleted file mode 100644 index e2d580827f..00 --- a/tests/qemuxml2argvdata/disk-scsi-megasas.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device megasas,id=scsi0,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ --drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-4-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=4,lun=0,\ -drive=drive-scsi0-0-4-0,id=scsi0-0-4-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-scsi-megasas.xml b/tests/qemuxml2argvdata/disk-scsi-megasas.xml deleted file mode 100644 index 2ada09f51c..00 --- a/tests/qemuxml2argvdata/disk-scsi-megasas.xml +++ /dev/null @@ -1,35 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args index 549a162808..65ff7979eb 100644 --- a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args @@ -25,11 +25,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device lsi,id=scsi0,bus=pci.0,addr=0x2 \ +-device megasas,id=scsi1,bus=pci.0,addr=0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ -drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-0 \ -device scsi-hd,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-drive file=/tmp/scsidisk2.img,format=raw,if=none,id=drive-scsi1-0-0-0 \ +-device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,\ +id=scsi1-0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-scsi.xml b/tests/qemuxml2argvdata/disk-scsi.xml index 4d17952fae..3318dc277c 100644 --- a/tests/qemuxml2argvdata/disk-scsi.xml +++ b/tests/qemuxml2argvdata/disk-scsi.xml @@ -24,9 +24,15 @@ + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6e6c95ecd1..a3c93ceb0d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1130,8 +1130,6 @@ mymain(void) QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-scsi-vscsi", NONE); DO_TEST_CAPS_LATEST("controller-virtio-scsi"); -DO_TEST("disk-scsi-megasas", -QEMU_CAPS_SCSI_MEGASAS); DO_TEST("disk-scsi-mptsas1068", QEMU_CAPS_SCSI_MPTSAS1068, QEMU_CAPS_SCSI_DISK_WWN); diff --git a/tests/qemuxml2xmloutdata/disk-scsi-megasas.xml b/tests/qemuxml2xmloutdata/disk-scsi-megasas.xml deleted file mode 100644 index 3453f1f750..00 --- a/tests/qemuxml2xmloutdata/disk-scsi-megasas.xml +++ /dev/null @@ -1,45 +0,0 @@ - - QEMUGuest1 -
[libvirt] [PATCH v2 17/32] tests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a special test for this controller. Signed-off-by: Peter Krempa --- .../disk-scsi-mptsas1068.args | 31 - .../qemuxml2argvdata/disk-scsi-mptsas1068.xml | 36 --- .../disk-scsi.x86_64-latest.args | 6 ++- tests/qemuxml2argvdata/disk-scsi.xml | 7 +++ tests/qemuxml2argvtest.c | 3 -- .../disk-scsi-mptsas1068.xml | 46 --- tests/qemuxml2xmloutdata/disk-scsi.xml| 12 - tests/qemuxml2xmltest.c | 6 +-- 8 files changed, 25 insertions(+), 122 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-scsi-mptsas1068.args delete mode 100644 tests/qemuxml2argvdata/disk-scsi-mptsas1068.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-scsi-mptsas1068.xml diff --git a/tests/qemuxml2argvdata/disk-scsi-mptsas1068.args b/tests/qemuxml2argvdata/disk-scsi-mptsas1068.args deleted file mode 100644 index 0ceddb4d46..00 --- a/tests/qemuxml2argvdata/disk-scsi-mptsas1068.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device mptsas1068,id=scsi0,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ --drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-4-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=4,lun=0,\ -drive=drive-scsi0-0-4-0,id=scsi0-0-4-0,wwn=0x5000c50015ea71ac \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-scsi-mptsas1068.xml b/tests/qemuxml2argvdata/disk-scsi-mptsas1068.xml deleted file mode 100644 index 496f2343de..00 --- a/tests/qemuxml2argvdata/disk-scsi-mptsas1068.xml +++ /dev/null @@ -1,36 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - 5000c50015ea71ac - - - - - - - - - - diff --git a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args index 65ff7979eb..1b22e18a18 100644 --- a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args @@ -26,6 +26,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device lsi,id=scsi0,bus=pci.0,addr=0x2 \ -device megasas,id=scsi1,bus=pci.0,addr=0x3 \ +-device mptsas1068,id=scsi2,bus=pci.0,addr=0x4 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ -drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-0 \ @@ -33,7 +34,10 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -drive file=/tmp/scsidisk2.img,format=raw,if=none,id=drive-scsi1-0-0-0 \ -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,\ id=scsi1-0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ +-drive file=/tmp/scsidisk3.img,format=raw,if=none,id=drive-scsi2-0-0-0 \ +-device scsi-hd,bus=scsi2.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi2-0-0-0,\ +id=scsi2-0-0-0,wwn=0x5000c50015ea71ac \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-scsi.xml b/tests/qemuxml2argvdata/disk-scsi.xml index 3318dc277c..6049ea2069 100644 --- a/tests/qemuxml2argvdata/disk-scsi.xml +++ b/tests/qemuxml2argvdata/disk-scsi.xml @@ -29,10 +29,17 @@ + + + + + 5000c50015ea71ac + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a3c93ceb0d..0c4b97615b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1130,9 +1130,6 @@ mymain(void) QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-scsi-vscsi", NONE); DO_TEST_CAPS_LATEST("controller-virtio-scsi"); -DO_TEST("disk-scsi-mptsas1068", -QEMU_CAPS_SCSI_MPTSAS1068, -QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-sata-device",
[libvirt] [PATCH v2 13/32] tests: qemuxml2argv: Move cases from 'disk-shared-locking' into 'disk-shared'
The tests are for the same feature. Move all the cases to 'disk-shared' case as it's already using DO_TEST_CAPS_LATEST Signed-off-by: Peter Krempa --- .../qemuxml2argvdata/disk-shared-locking.args | 34 --- .../qemuxml2argvdata/disk-shared-locking.xml | 42 --- .../disk-shared.x86_64-2.12.0.args| 9 +++- .../disk-shared.x86_64-latest.args| 9 +++- tests/qemuxml2argvdata/disk-shared.xml| 14 +++ tests/qemuxml2argvtest.c | 2 - 6 files changed, 30 insertions(+), 80 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-shared-locking.args delete mode 100644 tests/qemuxml2argvdata/disk-shared-locking.xml diff --git a/tests/qemuxml2argvdata/disk-shared-locking.args b/tests/qemuxml2argvdata/disk-shared-locking.args deleted file mode 100644 index 9ced336ec4..00 --- a/tests/qemuxml2argvdata/disk-shared-locking.args +++ /dev/null @@ -1,34 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/ide,format=raw,if=none,id=drive-ide0-0-0,cache=none \ --device ide-drive,bus=ide.0,unit=0,share-rw=on,drive=drive-ide0-0-0,\ -id=ide0-0-0,bootindex=1 \ --drive file=/dev/scsi,format=raw,if=none,id=drive-scsi0-0-0-0,cache=none \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,share-rw=on,\ -drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \ --drive file=/dev/virtio,format=raw,if=none,id=drive-virtio-disk0,cache=none \ --device virtio-blk-pci,bus=pci.0,addr=0x4,share-rw=on,drive=drive-virtio-disk0,\ -id=virtio-disk0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 diff --git a/tests/qemuxml2argvdata/disk-shared-locking.xml b/tests/qemuxml2argvdata/disk-shared-locking.xml deleted file mode 100644 index dd48857a30..00 --- a/tests/qemuxml2argvdata/disk-shared-locking.xml +++ /dev/null @@ -1,42 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvdata/disk-shared.x86_64-2.12.0.args b/tests/qemuxml2argvdata/disk-shared.x86_64-2.12.0.args index 96d8063abb..15c3b75df1 100644 --- a/tests/qemuxml2argvdata/disk-shared.x86_64-2.12.0.args +++ b/tests/qemuxml2argvdata/disk-shared.x86_64-2.12.0.args @@ -24,6 +24,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -no-acpi \ -boot strict=on \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0,\ cache=none \ -device ide-hd,bus=ide.0,unit=0,share-rw=on,drive=drive-ide0-0-0,id=ide0-0-0,\ @@ -31,7 +32,13 @@ bootindex=1,write-cache=on,serial=XYZXYZXYZYXXYZYZYXYZY \ -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-1-0,\ readonly=on \ -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-drive file=/dev/scsi,format=raw,if=none,id=drive-scsi0-0-0-0,cache=none \ +-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,share-rw=on,\ +drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,write-cache=on \ +-drive file=/dev/virtio,format=raw,if=none,id=drive-virtio-disk0,cache=none \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,share-rw=on,\ +drive=drive-virtio-disk0,id=virtio-disk0,write-cache=on \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args b/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args index 15f8c6b3d7..4913d1ed20 100644 --- a/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args @@ -24,6 +24,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -no-acpi \ -boot strict=on \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0,\ cache=none \ -device ide-hd,bus=ide.0,unit=0,share-rw=on,drive=drive-ide0-0-0,id=ide0-0-0,\ @@ -31,7 +32,13 @@
[libvirt] [PATCH v2 10/32] tests: qemuxml2argv: Use real caps when auto-generating SCSI controller type
Using an old strict set of capabilities is not of much use if a code path would select a more modern controller on accident. Signed-off-by: Peter Krempa --- ...> disk-scsi-device-auto.x86_64-1.5.3.args} | 11 +++--- .../disk-scsi-device-auto.x86_64-latest.args | 35 +++ tests/qemuxml2argvtest.c | 4 +-- 3 files changed, 43 insertions(+), 7 deletions(-) rename tests/qemuxml2argvdata/{disk-scsi-device-auto.args => disk-scsi-device-auto.x86_64-1.5.3.args} (69%) create mode 100644 tests/qemuxml2argvdata/disk-scsi-device-auto.x86_64-latest.args diff --git a/tests/qemuxml2argvdata/disk-scsi-device-auto.args b/tests/qemuxml2argvdata/disk-scsi-device-auto.x86_64-1.5.3.args similarity index 69% rename from tests/qemuxml2argvdata/disk-scsi-device-auto.args rename to tests/qemuxml2argvdata/disk-scsi-device-auto.x86_64-1.5.3.args index c28a7b87be..e2ff678c4e 100644 --- a/tests/qemuxml2argvdata/disk-scsi-device-auto.args +++ b/tests/qemuxml2argvdata/disk-scsi-device-auto.x86_64-1.5.3.args @@ -7,8 +7,9 @@ QEMU_AUDIO_DRV=none \ /usr/bin/qemu-system-i686 \ -name QEMUGuest1 \ -S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-machine pc-i440fx-1.5,accel=tcg,usb=off,dump-guest-core=off \ -m 214 \ +-realtime mlock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ @@ -20,11 +21,11 @@ server,nowait \ -rtc base=utc \ -no-shutdown \ -no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device lsi,id=scsi0,bus=pci.0,addr=0x3 \ --usb \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ -drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-0 \ --device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ +-device scsi-hd,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-scsi-device-auto.x86_64-latest.args b/tests/qemuxml2argvdata/disk-scsi-device-auto.x86_64-latest.args new file mode 100644 index 00..549a162808 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-scsi-device-auto.x86_64-latest.args @@ -0,0 +1,35 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-i686 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-device lsi,id=scsi0,bus=pci.0,addr=0x2 \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ +-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ +-drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-0 \ +-device scsi-hd,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 16909dc8a6..5022061e04 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1167,8 +1167,8 @@ mymain(void) QEMU_CAPS_DEVICE_USB_STORAGE); DO_TEST("disk-scsi-device", QEMU_CAPS_SCSI_LSI); -DO_TEST("disk-scsi-device-auto", -QEMU_CAPS_SCSI_LSI); +DO_TEST_CAPS_VER("disk-scsi-device-auto", "1.5.3"); +DO_TEST_CAPS_LATEST("disk-scsi-device-auto"); DO_TEST("disk-scsi-disk-split", QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-scsi-disk-wwn", -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 08/32] tests: qemuxml: Merge 'max_sectors' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the process. Signed-off-by: Peter Krempa --- .../controller-virtio-scsi.x86_64-latest.args | 6 ++- .../controller-virtio-scsi.xml| 8 .../disk-virtio-scsi-max_sectors.args | 28 -- .../disk-virtio-scsi-max_sectors.xml | 31 tests/qemuxml2argvtest.c | 2 - .../controller-virtio-scsi.xml| 12 +- .../disk-virtio-scsi-max_sectors.xml | 37 --- tests/qemuxml2xmltest.c | 2 - 8 files changed, 24 insertions(+), 102 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.args delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-virtio-scsi-max_sectors.xml diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args index 954553e6d7..3779e892b6 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args @@ -27,6 +27,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \ -device virtio-scsi-pci,id=scsi1,num_queues=8,bus=pci.0,addr=0x3 \ -device virtio-scsi-pci,id=scsi2,cmd_per_lun=50,bus=pci.0,addr=0x4 \ +-device virtio-scsi-pci,id=scsi3,max_sectors=512,bus=pci.0,addr=0x5 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ id=scsi0-0-0-0,bootindex=1 \ @@ -36,7 +37,10 @@ id=scsi1-0-0-0 \ -drive file=/dev/HostVG/QEMUGuest3,format=raw,if=none,id=drive-scsi2-0-0-0 \ -device scsi-hd,bus=scsi2.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi2-0-0-0,\ id=scsi2-0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 \ +-drive file=/dev/HostVG/QEMUGuest4,format=raw,if=none,id=drive-scsi3-0-0-0 \ +-device scsi-hd,bus=scsi3.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi3-0-0-0,\ +id=scsi3-0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.xml b/tests/qemuxml2argvdata/controller-virtio-scsi.xml index 64d34b0fb2..ebf608d1fd 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.xml +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.xml @@ -29,6 +29,11 @@ + + + + + @@ -37,6 +42,9 @@ + + + diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.args b/tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.args deleted file mode 100644 index 071ae542f4..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.args +++ /dev/null @@ -1,28 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 8,sockets=8,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device virtio-scsi-pci,id=scsi0,max_sectors=512,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ -drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.xml b/tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.xml deleted file mode 100644 index 838e4844b4..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-max_sectors.xml +++ /dev/null @@ -1,31 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 8 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index bfae41605c..fbaeb51443 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1181,8 +1181,6 @@ mymain(void) QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-scsi-vscsi", NONE); -DO_TEST("disk-virtio-scsi-max_sectors", -QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-ioeventfd", QEMU_CAPS_VIRTIO_IOEVENTFD,
[libvirt] [PATCH v2 32/32] qemu: caps: Add lockout for -blockdev if QEMU_CAPS_SCSI_DISK_DEVICE_ID is not present
Avoid regressions by disallowing the BLOCKDEV capability. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 290c8c2bdb..42a444a2f5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4331,6 +4331,11 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_GUEST); } +/* To avoid guest ABI regression, blockdev shall be enabled only when + * we are able to pass the custom 'device_id' for SCSI disks and cdroms. */ +if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_DEVICE_ID)) +virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV); + ret = 0; cleanup: return ret; -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 31/32] qemu: Use the 'device_id' property of SCSI disks to avoid regressing
QEMU accidentally exposed the id of -drive (or same value as disk serial, if provided) in one of the identifiers visible from the guest. To avoid regression in case when -blockdev will be used we need to always specify it ourselves. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 22 +++ .../controller-virtio-scsi.x86_64-latest.args | 20 - .../disk-cache.x86_64-latest.args | 4 ++-- .../disk-scsi-device-auto.x86_64-latest.args | 3 ++- .../disk-scsi.x86_64-latest.args | 16 -- .../disk-shared.x86_64-latest.args| 5 +++-- ...threads-virtio-scsi-pci.x86_64-latest.args | 4 ++-- 7 files changed, 50 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index eaeeb3a05d..e6c1219dac 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1890,6 +1890,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus); const char *contAlias; char *backendAlias = NULL; +char *scsiVPDDeviceId = NULL; int controllerModel; if (qemuCheckDiskConfig(disk, qemuCaps) < 0) @@ -1979,6 +1980,21 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virBufferAddLit(, "scsi-cd"); else virBufferAddLit(, "scsi-hd"); + +/* qemu historically used the name of -drive as one of the device + * ids in the Vital Product Data Device Identification page if + * disk serial was not set and the disk serial otherwise. + * To avoid a guest-visible regression we need to provide it + * ourselves especially for cases when -blockdev will be used */ +if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_DEVICE_ID)) { +if (disk->serial) { +if (VIR_STRDUP(scsiVPDDeviceId, disk->serial) < 0) +goto error; +} else { +if (!(scsiVPDDeviceId = qemuAliasDiskDriveFromDisk(disk))) +goto error; +} +} } if (!(contAlias = virDomainControllerAliasFind(def, VIR_DOMAIN_CONTROLLER_TYPE_SCSI, @@ -2021,6 +2037,12 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, disk->info.addr.drive.target, disk->info.addr.drive.unit); } + +if (scsiVPDDeviceId) { +virBufferAddLit(, ",device_id="); +virBufferEscape(, '\\', " ", "%s", scsiVPDDeviceId); +} + break; case VIR_DOMAIN_DISK_BUS_SATA: diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args index cf8a497eb7..095b4724d3 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args @@ -30,20 +30,20 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device virtio-scsi-pci,id=scsi3,max_sectors=512,bus=pci.0,addr=0x5 \ -device virtio-scsi-pci,id=scsi4,ioeventfd=on,bus=pci.0,addr=0x6 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ --device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ -id=scsi0-0-0-0,bootindex=1 \ +-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ +device_id=drive-scsi0-0-0-0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \ -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-scsi1-0-0-0 \ --device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,\ -id=scsi1-0-0-0 \ +-device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,\ +device_id=drive-scsi1-0-0-0,drive=drive-scsi1-0-0-0,id=scsi1-0-0-0 \ -drive file=/dev/HostVG/QEMUGuest3,format=raw,if=none,id=drive-scsi2-0-0-0 \ --device scsi-hd,bus=scsi2.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi2-0-0-0,\ -id=scsi2-0-0-0 \ +-device scsi-hd,bus=scsi2.0,channel=0,scsi-id=0,lun=0,\ +device_id=drive-scsi2-0-0-0,drive=drive-scsi2-0-0-0,id=scsi2-0-0-0 \ -drive file=/dev/HostVG/QEMUGuest4,format=raw,if=none,id=drive-scsi3-0-0-0 \ --device scsi-hd,bus=scsi3.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi3-0-0-0,\ -id=scsi3-0-0-0 \ +-device scsi-hd,bus=scsi3.0,channel=0,scsi-id=0,lun=0,\ +device_id=drive-scsi3-0-0-0,drive=drive-scsi3-0-0-0,id=scsi3-0-0-0 \ -drive file=/dev/HostVG/QEMUGuest5,format=raw,if=none,id=drive-scsi4-0-0-0 \ --device scsi-hd,bus=scsi4.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi4-0-0-0,\ -id=scsi4-0-0-0 \ +-device scsi-hd,bus=scsi4.0,channel=0,scsi-id=0,lun=0,\ +device_id=drive-scsi4-0-0-0,drive=drive-scsi4-0-0-0,id=scsi4-0-0-0 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ diff --git
[libvirt] [PATCH v2 12/32] tests: qemuxml2argv: Remove the 'after startup XML' testing machinery
A lot of code with no real impact and popularity. Remove all the helpers now that the only test case is gone. Signed-off-by: Peter Krempa --- tests/Makefile.am| 1 - tests/qemuxml2argvtest.c | 54 +++- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index bdf7154fd5..ceb15d9218 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -129,7 +129,6 @@ EXTRA_DIST = \ qemumigparamsdata \ qemumonitorjsondata \ qemuxml2argvdata \ - qemuxml2startupxmloutdata \ qemuxml2xmloutdata \ qemustatusxml2xmldata \ qemumemlockdata \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c3f4640044..046c28c4b8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -291,9 +291,8 @@ typedef enum { FLAG_EXPECT_FAILURE = 1 << 0, FLAG_EXPECT_PARSE_ERROR = 1 << 1, FLAG_FIPS = 1 << 2, -FLAG_STEAL_VM = 1 << 3, -FLAG_REAL_CAPS = 1 << 4, -FLAG_SKIP_LEGACY_CPUS = 1 << 5, +FLAG_REAL_CAPS = 1 << 3, +FLAG_SKIP_LEGACY_CPUS = 1 << 4, } virQemuXML2ArgvTestFlags; struct testInfo { @@ -304,7 +303,6 @@ struct testInfo { int migrateFd; unsigned int flags; unsigned int parseFlags; -virDomainObjPtr vm; }; @@ -428,49 +426,16 @@ testUpdateQEMUCaps(const struct testInfo *info, } -static int -testCompareXMLToStartupXML(const void *data) -{ -const struct testInfo *info = data; -unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE; -char *xml = NULL; -char *actual = NULL; -int ret = -1; - -if (!info->vm) { -VIR_TEST_DEBUG("VM object missing. Did the args conversion succeed?"); -return -1; -} - -if (virAsprintf(, "%s/qemuxml2startupxmloutdata/%s.xml", -abs_srcdir, info->name) < 0) -goto cleanup; - -if (!(actual = virDomainDefFormat(info->vm->def, NULL, format_flags))) -goto cleanup; - -ret = virTestCompareToFile(actual, xml); - - cleanup: -VIR_FREE(xml); -VIR_FREE(actual); -return ret; -} - - static int testCheckExclusiveFlags(int flags) { virCheckFlags(FLAG_EXPECT_FAILURE | FLAG_EXPECT_PARSE_ERROR | FLAG_FIPS | - FLAG_STEAL_VM | FLAG_REAL_CAPS | FLAG_SKIP_LEGACY_CPUS | 0, -1); -VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_FAILURE, -1); -VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_PARSE_ERROR, -1); VIR_EXCLUSIVE_FLAGS_RET(FLAG_REAL_CAPS, FLAG_SKIP_LEGACY_CPUS, -1); return 0; } @@ -643,9 +608,6 @@ testCompareXMLToArgv(const void *data) ret = 0; } -if (flags & FLAG_STEAL_VM) -VIR_STEAL_PTR(info->vm, vm); - cleanup: VIR_FREE(log); VIR_FREE(actualargv); @@ -781,7 +743,7 @@ mymain(void) do { \ static struct testInfo info = { \ name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\ -(flags | FLAG_REAL_CAPS), parseFlags, NULL \ +(flags | FLAG_REAL_CAPS), parseFlags, \ }; \ if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \ capsfile))) \ @@ -792,7 +754,6 @@ mymain(void) testCompareXMLToArgv, ) < 0) \ ret = -1; \ virObjectUnref(info.qemuCaps); \ -virObjectUnref(info.vm); \ } while (0) # define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata/caps_" @@ -838,7 +799,6 @@ mymain(void) do { \ static struct testInfo info = { \ name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \ -NULL \ }; \ if (testInitQEMUCaps(, gic) < 0) \ return EXIT_FAILURE; \ @@ -846,12 +806,7 @@ mymain(void) if (virTestRun("QEMU XML-2-ARGV " name, \ testCompareXMLToArgv, ) < 0) \ ret = -1; \ -if (((flags) & FLAG_STEAL_VM) && \ -virTestRun("QEMU XML-2-startup-XML " name, \ - testCompareXMLToStartupXML, ) < 0) \ -ret = -1; \ virObjectUnref(info.qemuCaps); \ -virObjectUnref(info.vm); \ } while (0) # define DO_TEST(name, ...) \ @@ -860,9 +815,6 @@ mymain(void) # define DO_TEST_GIC(name, gic, ...) \ DO_TEST_FULL(name, NULL, -1, 0, 0, gic, __VA_ARGS__) -# define DO_TEST_WITH_STARTUP(name, ...) \ -DO_TEST_FULL(name, NULL, -1, FLAG_STEAL_VM, 0, GIC_NONE, __VA_ARGS__) - # define DO_TEST_FAILURE(name, ...) \ DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, \ 0, GIC_NONE, __VA_ARGS__) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 07/32] tests: qemuxml: Merge 'cmd_per_lun' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the process. Signed-off-by: Peter Krempa --- .../controller-virtio-scsi.x86_64-latest.args | 6 ++- .../controller-virtio-scsi.xml| 8 .../disk-virtio-scsi-cmd_per_lun.args | 28 -- .../disk-virtio-scsi-cmd_per_lun.xml | 31 tests/qemuxml2argvtest.c | 2 - .../controller-virtio-scsi.xml| 12 +- .../disk-virtio-scsi-cmd_per_lun.xml | 37 --- tests/qemuxml2xmltest.c | 2 - 8 files changed, 24 insertions(+), 102 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.args delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-virtio-scsi-cmd_per_lun.xml diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args index 7552f09019..954553e6d7 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args @@ -26,13 +26,17 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \ -device virtio-scsi-pci,id=scsi1,num_queues=8,bus=pci.0,addr=0x3 \ +-device virtio-scsi-pci,id=scsi2,cmd_per_lun=50,bus=pci.0,addr=0x4 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ id=scsi0-0-0-0,bootindex=1 \ -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-scsi1-0-0-0 \ -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,\ id=scsi1-0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ +-drive file=/dev/HostVG/QEMUGuest3,format=raw,if=none,id=drive-scsi2-0-0-0 \ +-device scsi-hd,bus=scsi2.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi2-0-0-0,\ +id=scsi2-0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.xml b/tests/qemuxml2argvdata/controller-virtio-scsi.xml index ec27166386..64d34b0fb2 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.xml +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.xml @@ -24,11 +24,19 @@ + + + + + + + + diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.args b/tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.args deleted file mode 100644 index d8318b4c29..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.args +++ /dev/null @@ -1,28 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 8,sockets=8,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device virtio-scsi-pci,id=scsi0,cmd_per_lun=50,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ -drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.xml b/tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.xml deleted file mode 100644 index 7c44beaabe..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-cmd_per_lun.xml +++ /dev/null @@ -1,31 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 8 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ee54674666..bfae41605c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1181,8 +1181,6 @@ mymain(void) QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-scsi-vscsi", NONE); -DO_TEST("disk-virtio-scsi-cmd_per_lun", -QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-max_sectors", QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-ioeventfd", diff --git
[libvirt] [PATCH v2 22/32] qemu: caps: Always assume presence of 'scsi-hd' and 'scsi-cd' device
The split of scsi-disk into the two separate devices was introduced by qemu commit b443ae67 released in qemu v0.15. All changes to test files are not really related to disk testing thanks to previous refactors. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 1 - src/qemu/qemu_capabilities.h | 2 +- src/qemu/qemu_command.c | 19 ++- .../caps_1.5.3.x86_64.xml | 1 - .../caps_1.6.0.x86_64.xml | 1 - .../caps_1.7.0.x86_64.xml | 1 - .../caps_2.1.1.x86_64.xml | 1 - .../caps_2.10.0.aarch64.xml | 1 - .../caps_2.10.0.ppc64.xml | 1 - .../caps_2.10.0.s390x.xml | 1 - .../caps_2.10.0.x86_64.xml| 1 - .../caps_2.11.0.s390x.xml | 1 - .../caps_2.11.0.x86_64.xml| 1 - .../caps_2.12.0.aarch64.xml | 1 - .../caps_2.12.0.ppc64.xml | 1 - .../caps_2.12.0.s390x.xml | 1 - .../caps_2.12.0.x86_64.xml| 1 - .../caps_2.4.0.x86_64.xml | 1 - .../caps_2.5.0.x86_64.xml | 1 - .../caps_2.6.0.aarch64.xml| 1 - .../qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 - .../caps_2.6.0.x86_64.xml | 1 - .../qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 - .../caps_2.7.0.x86_64.xml | 1 - .../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 - .../caps_2.8.0.x86_64.xml | 1 - .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 - .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 - .../caps_2.9.0.x86_64.xml | 1 - .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 - .../caps_3.0.0.riscv32.xml| 1 - .../caps_3.0.0.riscv64.xml| 1 - .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 - .../caps_3.0.0.x86_64.xml | 1 - .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 - .../caps_3.1.0.x86_64.xml | 1 - .../caps_4.0.0.riscv32.xml| 1 - .../caps_4.0.0.riscv64.xml| 1 - .../caps_4.0.0.x86_64.xml | 1 - .../aarch64-virtio-pci-manual-addresses.args | 4 ++-- tests/qemuxml2argvdata/bios-nvram-secure.args | 4 ++-- tests/qemuxml2argvdata/machine-smm-opt.args | 4 ++-- .../multifunction-pci-device.args | 2 +- .../pseries-vio-user-assigned.args| 4 ++-- tests/qemuxml2argvdata/pseries-vio.args | 4 ++-- tests/qemuxml2argvtest.c | 11 --- tests/qemuxml2xmltest.c | 6 ++ 47 files changed, 24 insertions(+), 73 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 3d7d05cd99..7033615eb5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1023,7 +1023,6 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "qxl", QEMU_CAPS_DEVICE_QXL }, { "sga", QEMU_CAPS_SGA }, { "scsi-block", QEMU_CAPS_SCSI_BLOCK }, -{ "scsi-cd", QEMU_CAPS_SCSI_CD }, { "ide-cd", QEMU_CAPS_IDE_CD }, { "VGA", QEMU_CAPS_DEVICE_VGA }, { "cirrus-vga", QEMU_CAPS_DEVICE_CIRRUS_VGA }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6d5ed8a3cc..f9810bee92 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -174,7 +174,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 90 */ X_QEMU_CAPS_BLOCKJOB_SYNC, /* old block_job_cancel, block_stream */ QEMU_CAPS_BLOCKJOB_ASYNC, /* new block-job-cancel, block-stream */ -QEMU_CAPS_SCSI_CD, /* -device scsi-cd */ +X_QEMU_CAPS_SCSI_CD, /* -device scsi-cd */ QEMU_CAPS_IDE_CD, /* -device ide-cd */ X_QEMU_CAPS_NO_USER_CONFIG, /* -no-user-config */ diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 374836a35e..d9f64b8097 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1762,13 +1762,10 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, * legacy -drive is used. In modern qemu the 'ide-cd' or 'scsi-cd' are used. * virtio and other just ignore the attribute anyways */ if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { -if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { -if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD)) -virBufferAddLit(, ",media=cdrom"); -} else if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) { +if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_CD)) virBufferAddLit(, ",media=cdrom"); -} else { +} else if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI) { virBufferAddLit(,
[libvirt] [PATCH v2 05/32] tests: qemu: Remove 'disk-scsi-virtio-scsi' test
Now that we have a specific test for testing the 'virtio-scsi' controller and other tests which test a combination of scsi and non-scsi devices this test no longer makes sense. Signed-off-by: Peter Krempa --- .../disk-scsi-virtio-scsi.args| 31 - .../disk-scsi-virtio-scsi.xml | 35 --- tests/qemuxml2argvtest.c | 2 - .../disk-scsi-virtio-scsi.xml | 45 --- tests/qemuxml2xmltest.c | 2 - 5 files changed, 115 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-scsi-virtio-scsi.args delete mode 100644 tests/qemuxml2argvdata/disk-scsi-virtio-scsi.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-scsi-virtio-scsi.xml diff --git a/tests/qemuxml2argvdata/disk-scsi-virtio-scsi.args b/tests/qemuxml2argvdata/disk-scsi-virtio-scsi.args deleted file mode 100644 index 60760831ab..00 --- a/tests/qemuxml2argvdata/disk-scsi-virtio-scsi.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ --drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-4-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=4,lun=0,\ -drive=drive-scsi0-0-4-0,id=scsi0-0-4-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-scsi-virtio-scsi.xml b/tests/qemuxml2argvdata/disk-scsi-virtio-scsi.xml deleted file mode 100644 index 842c03d1ce..00 --- a/tests/qemuxml2argvdata/disk-scsi-virtio-scsi.xml +++ /dev/null @@ -1,35 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0a6a76edc5..65c02b731b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1181,8 +1181,6 @@ mymain(void) QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-scsi-vscsi", NONE); -DO_TEST("disk-scsi-virtio-scsi", -QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-num_queues", QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-cmd_per_lun", diff --git a/tests/qemuxml2xmloutdata/disk-scsi-virtio-scsi.xml b/tests/qemuxml2xmloutdata/disk-scsi-virtio-scsi.xml deleted file mode 100644 index 069a35f27c..00 --- a/tests/qemuxml2xmloutdata/disk-scsi-virtio-scsi.xml +++ /dev/null @@ -1,45 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index bef453850c..d22104a9dd 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -367,8 +367,6 @@ mymain(void) DO_TEST("disk-scsi-device", QEMU_CAPS_SCSI_LSI); DO_TEST("disk-scsi-vscsi", NONE); -DO_TEST("disk-scsi-virtio-scsi", -QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-num_queues", QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-reservations", -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 14/32] tests: qemu: Rename 'disk-scsi-device' to 'disk-scsi'
Drop the 'device' suffix which is quite pointless. Signed-off-by: Peter Krempa --- .../qemuxml2argvdata/{disk-scsi-device.args => disk-scsi.args} | 0 tests/qemuxml2argvdata/{disk-scsi-device.xml => disk-scsi.xml} | 0 tests/qemuxml2argvtest.c | 2 +- .../qemuxml2xmloutdata/{disk-scsi-device.xml => disk-scsi.xml} | 0 tests/qemuxml2xmltest.c| 3 +-- 5 files changed, 2 insertions(+), 3 deletions(-) rename tests/qemuxml2argvdata/{disk-scsi-device.args => disk-scsi.args} (100%) rename tests/qemuxml2argvdata/{disk-scsi-device.xml => disk-scsi.xml} (100%) rename tests/qemuxml2xmloutdata/{disk-scsi-device.xml => disk-scsi.xml} (100%) diff --git a/tests/qemuxml2argvdata/disk-scsi-device.args b/tests/qemuxml2argvdata/disk-scsi.args similarity index 100% rename from tests/qemuxml2argvdata/disk-scsi-device.args rename to tests/qemuxml2argvdata/disk-scsi.args diff --git a/tests/qemuxml2argvdata/disk-scsi-device.xml b/tests/qemuxml2argvdata/disk-scsi.xml similarity index 100% rename from tests/qemuxml2argvdata/disk-scsi-device.xml rename to tests/qemuxml2argvdata/disk-scsi.xml diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b7d313d215..e2f3230c59 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1114,7 +1114,7 @@ mymain(void) QEMU_CAPS_USB_STORAGE_REMOVABLE); DO_TEST_FAILURE("disk-usb-pci", QEMU_CAPS_DEVICE_USB_STORAGE); -DO_TEST("disk-scsi-device", +DO_TEST("disk-scsi", QEMU_CAPS_SCSI_LSI); DO_TEST_CAPS_VER("disk-scsi-device-auto", "1.5.3"); DO_TEST_CAPS_LATEST("disk-scsi-device-auto"); diff --git a/tests/qemuxml2xmloutdata/disk-scsi-device.xml b/tests/qemuxml2xmloutdata/disk-scsi.xml similarity index 100% rename from tests/qemuxml2xmloutdata/disk-scsi-device.xml rename to tests/qemuxml2xmloutdata/disk-scsi.xml diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 7b755de39f..fc8ed318b8 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -364,8 +364,7 @@ mymain(void) DO_TEST("disk-network-sheepdog", NONE); DO_TEST("disk-network-vxhs", NONE); DO_TEST("disk-network-tlsx509", NONE); -DO_TEST("disk-scsi-device", -QEMU_CAPS_SCSI_LSI); +DO_TEST("disk-scsi", QEMU_CAPS_SCSI_LSI); DO_TEST("disk-scsi-vscsi", NONE); DO_TEST("disk-virtio-scsi-reservations", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_PR_MANAGER_HELPER); -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 20/32] tests: qemuxml2argv: Modernize virtio-scsi iothread tests
Use DO_TEST_CAPS_LATEST to obtain actual results. Signed-off-by: Peter Krempa --- ...threads-virtio-scsi-ccw.s390x-latest.args} | 20 ++-- ...hreads-virtio-scsi-pci.x86_64-latest.args} | 23 +++ tests/qemuxml2argvtest.c | 8 ++- 3 files changed, 29 insertions(+), 22 deletions(-) rename tests/qemuxml2argvdata/{iothreads-virtio-scsi-ccw.args => iothreads-virtio-scsi-ccw.s390x-latest.args} (58%) rename tests/qemuxml2argvdata/{iothreads-virtio-scsi-pci.args => iothreads-virtio-scsi-pci.x86_64-latest.args} (57%) diff --git a/tests/qemuxml2argvdata/iothreads-virtio-scsi-ccw.args b/tests/qemuxml2argvdata/iothreads-virtio-scsi-ccw.s390x-latest.args similarity index 58% rename from tests/qemuxml2argvdata/iothreads-virtio-scsi-ccw.args rename to tests/qemuxml2argvdata/iothreads-virtio-scsi-ccw.s390x-latest.args index 08d38942f6..1c5be88a47 100644 --- a/tests/qemuxml2argvdata/iothreads-virtio-scsi-ccw.args +++ b/tests/qemuxml2argvdata/iothreads-virtio-scsi-ccw.s390x-latest.args @@ -5,10 +5,13 @@ USER=test \ LOGNAME=test \ QEMU_AUDIO_DRV=none \ /usr/bin/qemu-system-s390x \ --name QEMUGuest1 \ +-name guest=QEMUGuest1,debug-threads=on \ -S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine s390-ccw,accel=tcg,usb=off,dump-guest-core=off \ -m 214 \ +-realtime mlock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -object iothread,id=iothread1 \ -object iothread,id=iothread2 \ @@ -16,16 +19,19 @@ QEMU_AUDIO_DRV=none \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc \ -no-shutdown \ +-boot strict=on \ -device virtio-scsi-ccw,iothread=iothread2,id=scsi0,devno=fe.0.0001 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-ccw,iothread=iothread1,devno=fe.0.,\ +-device virtio-blk-ccw,iothread=iothread1,scsi=off,devno=fe.0.,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-scsi0-0-2-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=2,lun=0,\ -drive=drive-scsi0-0-2-0,id=scsi0-0-2-0 \ --device virtio-balloon-ccw,id=balloon0,devno=fe.0.000a +-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=2,lun=0,drive=drive-scsi0-0-2-0,\ +id=scsi0-0-2-0 \ +-device virtio-balloon-ccw,id=balloon0,devno=fe.0.000a \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/iothreads-virtio-scsi-pci.args b/tests/qemuxml2argvdata/iothreads-virtio-scsi-pci.x86_64-latest.args similarity index 57% rename from tests/qemuxml2argvdata/iothreads-virtio-scsi-pci.args rename to tests/qemuxml2argvdata/iothreads-virtio-scsi-pci.x86_64-latest.args index ee346516cb..4513edcdd0 100644 --- a/tests/qemuxml2argvdata/iothreads-virtio-scsi-pci.args +++ b/tests/qemuxml2argvdata/iothreads-virtio-scsi-pci.x86_64-latest.args @@ -5,10 +5,13 @@ USER=test \ LOGNAME=test \ QEMU_AUDIO_DRV=none \ /usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ +-name guest=QEMUGuest1,debug-threads=on \ -S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,accel=tcg,usb=off,dump-guest-core=off \ -m 214 \ +-realtime mlock=off \ -smp 2,sockets=2,cores=1,threads=1 \ -object iothread,id=iothread1 \ -object iothread,id=iothread2 \ @@ -16,22 +19,24 @@ QEMU_AUDIO_DRV=none \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc \ -no-shutdown \ -no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device virtio-scsi-pci,iothread=iothread2,id=scsi0,bus=pci.0,addr=0xb \ --usb \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ -drive file=/var/lib/libvirt/images/iothrtest1.img,format=raw,if=none,\ id=drive-virtio-disk1 \ --device virtio-blk-pci,iothread=iothread1,bus=pci.0,addr=0x4,\ +-device virtio-blk-pci,iothread=iothread1,scsi=off,bus=pci.0,addr=0x4,\ drive=drive-virtio-disk1,id=virtio-disk1 \ -drive file=/var/lib/libvirt/images/iothrtest2.img,format=raw,if=none,\ id=drive-scsi0-0-0-3 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=3,\ -drive=drive-scsi0-0-0-3,id=scsi0-0-0-3 +-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=3,drive=drive-scsi0-0-0-3,\ +id=scsi0-0-0-3 \ +-sandbox
[libvirt] [PATCH v2 18/32] tests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a special test for this controller. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/disk-scsi-vscsi.args | 31 - tests/qemuxml2argvdata/disk-scsi-vscsi.xml| 35 --- .../disk-scsi.x86_64-latest.args | 4 ++ tests/qemuxml2argvdata/disk-scsi.xml | 6 +++ tests/qemuxml2argvtest.c | 1 - tests/qemuxml2xmloutdata/disk-scsi-vscsi.xml | 45 --- tests/qemuxml2xmloutdata/disk-scsi.xml| 9 tests/qemuxml2xmltest.c | 1 - 8 files changed, 19 insertions(+), 113 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-scsi-vscsi.args delete mode 100644 tests/qemuxml2argvdata/disk-scsi-vscsi.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-scsi-vscsi.xml diff --git a/tests/qemuxml2argvdata/disk-scsi-vscsi.args b/tests/qemuxml2argvdata/disk-scsi-vscsi.args deleted file mode 100644 index b733f0ebf3..00 --- a/tests/qemuxml2argvdata/disk-scsi-vscsi.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device spapr-vscsi,id=scsi0,reg=0x2000 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ --drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-3-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=3,lun=0,\ -drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/disk-scsi-vscsi.xml b/tests/qemuxml2argvdata/disk-scsi-vscsi.xml deleted file mode 100644 index 3cb74d4725..00 --- a/tests/qemuxml2argvdata/disk-scsi-vscsi.xml +++ /dev/null @@ -1,35 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args index 1b22e18a18..ac9f3ff02e 100644 --- a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args @@ -27,6 +27,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device lsi,id=scsi0,bus=pci.0,addr=0x2 \ -device megasas,id=scsi1,bus=pci.0,addr=0x3 \ -device mptsas1068,id=scsi2,bus=pci.0,addr=0x4 \ +-device spapr-vscsi,id=scsi3,reg=0x2000 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ -drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-0 \ @@ -37,6 +38,9 @@ id=scsi1-0-0-0 \ -drive file=/tmp/scsidisk3.img,format=raw,if=none,id=drive-scsi2-0-0-0 \ -device scsi-hd,bus=scsi2.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi2-0-0-0,\ id=scsi2-0-0-0,wwn=0x5000c50015ea71ac \ +-drive file=/tmp/scsidisk4.img,format=raw,if=none,id=drive-scsi3-0-0-0 \ +-device scsi-hd,bus=scsi3.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi3-0-0-0,\ +id=scsi3-0-0-0 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ diff --git a/tests/qemuxml2argvdata/disk-scsi.xml b/tests/qemuxml2argvdata/disk-scsi.xml index 6049ea2069..496d8cab39 100644 --- a/tests/qemuxml2argvdata/disk-scsi.xml +++ b/tests/qemuxml2argvdata/disk-scsi.xml @@ -35,11 +35,17 @@ 5000c50015ea71ac + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0c4b97615b..705327a046 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1128,7 +1128,6 @@ mymain(void) DO_TEST_FAILURE("disk-scsi-disk-vpd-build-error", QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); -DO_TEST("disk-scsi-vscsi", NONE); DO_TEST_CAPS_LATEST("controller-virtio-scsi"); DO_TEST("disk-sata-device", QEMU_CAPS_ICH9_AHCI); diff --git a/tests/qemuxml2xmloutdata/disk-scsi-vscsi.xml b/tests/qemuxml2xmloutdata/disk-scsi-vscsi.xml deleted file mode 100644 index 5f0cc50674..00 ---
[libvirt] [PATCH v2 19/32] tests: qemuxml2argv: Use 1.5.3 version for very old state in 'disk-cache'
Rather than testing random set of flags add a case also for the oldest supported qemu. Signed-off-by: Peter Krempa --- ...k-cache.args => disk-cache.x86_64-1.5.3.args} | 16 +--- tests/qemuxml2argvtest.c | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) rename tests/qemuxml2argvdata/{disk-cache.args => disk-cache.x86_64-1.5.3.args} (72%) diff --git a/tests/qemuxml2argvdata/disk-cache.args b/tests/qemuxml2argvdata/disk-cache.x86_64-1.5.3.args similarity index 72% rename from tests/qemuxml2argvdata/disk-cache.args rename to tests/qemuxml2argvdata/disk-cache.x86_64-1.5.3.args index a136201ffd..288d0aa43c 100644 --- a/tests/qemuxml2argvdata/disk-cache.args +++ b/tests/qemuxml2argvdata/disk-cache.x86_64-1.5.3.args @@ -9,6 +9,7 @@ QEMU_AUDIO_DRV=none \ -S \ -machine pc-i440fx-2.6,accel=tcg,usb=off,dump-guest-core=off \ -m 214 \ +-realtime mlock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ @@ -20,22 +21,23 @@ server,nowait \ -rtc base=utc \ -no-shutdown \ -no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device lsi,id=scsi0,bus=pci.0,addr=0x3 \ --usb \ -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\ cache=writeback \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-1,\ cache=unsafe \ --device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \ +-device ide-hd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \ -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-scsi0-0-0,\ cache=none \ --device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ +-device scsi-hd,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-virtio-disk0,\ cache=writethrough \ --device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\ id=virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-usb-disk1,\ cache=directsync \ --device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk1,id=usb-disk1 +-device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk1,id=usb-disk1,\ +removable=off diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 705327a046..d99b9acdc8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1063,7 +1063,7 @@ mymain(void) DO_TEST("disk-error-policy", NONE); DO_TEST_CAPS_VER("disk-error-policy", "2.12.0"); DO_TEST_CAPS_LATEST("disk-error-policy"); -DO_TEST("disk-cache", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_USB_STORAGE); +DO_TEST_CAPS_VER("disk-cache", "1.5.3"); DO_TEST_CAPS_VER("disk-cache", "2.6.0"); DO_TEST_CAPS_VER("disk-cache", "2.7.0"); DO_TEST_CAPS_VER("disk-cache", "2.12.0"); -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 11/32] tests: qemuxml2argv: Remove testing of post startup change to 'cachemode' for shared disks
Testing that the cachemode is properly recorded to the configuration after startup does not add much value and overcomplicates the xml2argv test. Remove the 'disk-shared' test with old capabilities, which would be done along as well as the test with real capabilities covers it sufficiently. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/disk-shared.args | 31 -- tests/qemuxml2argvtest.c | 1 - .../qemuxml2startupxmloutdata/disk-shared.xml | 56 --- 3 files changed, 88 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-shared.args delete mode 100644 tests/qemuxml2startupxmloutdata/disk-shared.xml diff --git a/tests/qemuxml2argvdata/disk-shared.args b/tests/qemuxml2argvdata/disk-shared.args deleted file mode 100644 index 550708c3b3..00 --- a/tests/qemuxml2argvdata/disk-shared.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0,\ -cache=none \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1,serial=XYZXYZXYZYXXYZYZYXYZY \ --drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-1-0,\ -media=cdrom,readonly=on \ --device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5022061e04..c3f4640044 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1105,7 +1105,6 @@ mymain(void) DO_TEST_PARSE_ERROR("disk-fmt-cow", NONE); DO_TEST_PARSE_ERROR("disk-fmt-dir", NONE); DO_TEST_PARSE_ERROR("disk-fmt-iso", NONE); -DO_TEST_WITH_STARTUP("disk-shared", NONE); DO_TEST_CAPS_VER("disk-shared", "2.12.0"); DO_TEST_CAPS_LATEST("disk-shared"); DO_TEST_PARSE_ERROR("disk-shared-qcow", NONE); diff --git a/tests/qemuxml2startupxmloutdata/disk-shared.xml b/tests/qemuxml2startupxmloutdata/disk-shared.xml deleted file mode 100644 index 60b7eca788..00 --- a/tests/qemuxml2startupxmloutdata/disk-shared.xml +++ /dev/null @@ -1,56 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - XYZXYZXYZYXXYZYZYXYZY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 15/32] tests: qemuxml2argv: Modernize 'disk-scsi' test
Use DO_TEST_CAPS_LATEST rather than a predetermined set of caps. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/disk-scsi.args | 30 .../disk-scsi.x86_64-latest.args | 35 +++ tests/qemuxml2argvtest.c | 3 +- 3 files changed, 36 insertions(+), 32 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-scsi.args create mode 100644 tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args diff --git a/tests/qemuxml2argvdata/disk-scsi.args b/tests/qemuxml2argvdata/disk-scsi.args deleted file mode 100644 index c28a7b87be..00 --- a/tests/qemuxml2argvdata/disk-scsi.args +++ /dev/null @@ -1,30 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device lsi,id=scsi0,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\ -bootindex=1 \ --drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-0 \ --device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args new file mode 100644 index 00..549a162808 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-scsi.x86_64-latest.args @@ -0,0 +1,35 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-i686 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-device lsi,id=scsi0,bus=pci.0,addr=0x2 \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ +-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ +-drive file=/tmp/scsidisk.img,format=raw,if=none,id=drive-scsi0-0-0 \ +-device scsi-hd,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e2f3230c59..6e6c95ecd1 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1114,8 +1114,7 @@ mymain(void) QEMU_CAPS_USB_STORAGE_REMOVABLE); DO_TEST_FAILURE("disk-usb-pci", QEMU_CAPS_DEVICE_USB_STORAGE); -DO_TEST("disk-scsi", -QEMU_CAPS_SCSI_LSI); +DO_TEST_CAPS_LATEST("disk-scsi"); DO_TEST_CAPS_VER("disk-scsi-device-auto", "1.5.3"); DO_TEST_CAPS_LATEST("disk-scsi-device-auto"); DO_TEST("disk-scsi-disk-split", -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 04/32] tests: qemuxml: Add a common test file for the 'virtio-scsi' controller
Add a file to agregate testing for 'virtio-scsi' based on the modern framework. Signed-off-by: Peter Krempa --- .../controller-virtio-scsi.x86_64-latest.args | 34 ++ .../controller-virtio-scsi.xml| 29 +++ tests/qemuxml2argvtest.c | 1 + .../controller-virtio-scsi.xml| 36 +++ tests/qemuxml2xmltest.c | 1 + 5 files changed, 101 insertions(+) create mode 100644 tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/controller-virtio-scsi.xml create mode 100644 tests/qemuxml2xmloutdata/controller-virtio-scsi.xml diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args new file mode 100644 index 00..e6f640f50f --- /dev/null +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-i686 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 8,sockets=8,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ +-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ +id=scsi0-0-0-0,bootindex=1 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.xml b/tests/qemuxml2argvdata/controller-virtio-scsi.xml new file mode 100644 index 00..4e24debed0 --- /dev/null +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.xml @@ -0,0 +1,29 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 8 + +hvm + + + + destroy + restart + destroy + +/usr/bin/qemu-system-i686 + + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6dc05c347f..0a6a76edc5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1191,6 +1191,7 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-ioeventfd", QEMU_CAPS_VIRTIO_IOEVENTFD, QEMU_CAPS_VIRTIO_SCSI); +DO_TEST_CAPS_LATEST("controller-virtio-scsi"); DO_TEST("disk-scsi-megasas", QEMU_CAPS_SCSI_MEGASAS); DO_TEST("disk-scsi-mptsas1068", diff --git a/tests/qemuxml2xmloutdata/controller-virtio-scsi.xml b/tests/qemuxml2xmloutdata/controller-virtio-scsi.xml new file mode 100644 index 00..3c1552d3a7 --- /dev/null +++ b/tests/qemuxml2xmloutdata/controller-virtio-scsi.xml @@ -0,0 +1,36 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 8 + +hvm + + + + destroy + restart + destroy + +/usr/bin/qemu-system-i686 + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 85261cb2e0..bef453850c 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -379,6 +379,7 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-ioeventfd", QEMU_CAPS_VIRTIO_SCSI); +DO_TEST("controller-virtio-scsi", QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-s390-zpci", QEMU_CAPS_DEVICE_ZPCI, QEMU_CAPS_CCW); -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 06/32] tests: qemuxml: Merge 'num-queues' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the process. Signed-off-by: Peter Krempa --- .../controller-virtio-scsi.x86_64-latest.args | 6 ++- .../controller-virtio-scsi.xml| 8 .../disk-virtio-scsi-num_queues.args | 28 -- .../disk-virtio-scsi-num_queues.xml | 31 tests/qemuxml2argvtest.c | 2 - .../controller-virtio-scsi.xml| 12 +- .../disk-virtio-scsi-num_queues.xml | 37 --- tests/qemuxml2xmltest.c | 2 - 8 files changed, 24 insertions(+), 102 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.args delete mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-virtio-scsi-num_queues.xml diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args index e6f640f50f..7552f09019 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.x86_64-latest.args @@ -25,10 +25,14 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \ +-device virtio-scsi-pci,id=scsi1,num_queues=8,bus=pci.0,addr=0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\ id=scsi0-0-0-0,bootindex=1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-scsi1-0-0-0 \ +-device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi1-0-0-0,\ +id=scsi1-0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/controller-virtio-scsi.xml b/tests/qemuxml2argvdata/controller-virtio-scsi.xml index 4e24debed0..ec27166386 100644 --- a/tests/qemuxml2argvdata/controller-virtio-scsi.xml +++ b/tests/qemuxml2argvdata/controller-virtio-scsi.xml @@ -19,8 +19,16 @@ + + + + + + + + diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.args b/tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.args deleted file mode 100644 index b0db76e09b..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.args +++ /dev/null @@ -1,28 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 214 \ --smp 8,sockets=8,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -server,nowait \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --device virtio-scsi-pci,id=scsi0,num_queues=8,bus=pci.0,addr=0x3 \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \ --device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ -drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.xml b/tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.xml deleted file mode 100644 index 4618271e74..00 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-num_queues.xml +++ /dev/null @@ -1,31 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 8 - -hvm - - - - destroy - restart - destroy - -/usr/bin/qemu-system-i686 - - - - - - - - - - - - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 65c02b731b..ee54674666 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1181,8 +1181,6 @@ mymain(void) QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-scsi-vscsi", NONE); -DO_TEST("disk-virtio-scsi-num_queues", -QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-cmd_per_lun", QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-max_sectors", diff --git a/tests/qemuxml2xmloutdata/controller-virtio-scsi.xml b/tests/qemuxml2xmloutdata/controller-virtio-scsi.xml index 3c1552d3a7..14498222de 100644 --- a/tests/qemuxml2xmloutdata/controller-virtio-scsi.xml +++ b/tests/qemuxml2xmloutdata/controller-virtio-scsi.xml @@ -20,17 +20,27 @@
[libvirt] [PATCH v2 02/32] qemu: capabilities: Probe caps for 'scsi-hd' instead of 'scsi-disk'
Since commit 02e8d0cfdf8 we are using 'scsi-hd' and 'scsi-cd' instead of 'scsi-disk'. We also should probe capabilities for 'scsi-hd' instead of 'scsi-disk'. It is safe to do as 'scsi-disk' is the common denominator of both 'scsi-hd' and 'scsi-cd' so all the properties were common. For now the test data are modified by just changing the appropriate type when probing for caps. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 2 +- tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.aarch64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.ppc64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.s390x.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.11.0.s390x.replies | 2 +- tests/qemucapabilitiesdata/caps_2.11.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.4.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.5.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.6.0.aarch64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.6.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_2.6.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.7.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_2.7.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.8.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_2.8.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.9.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_2.9.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_2.9.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies | 2 +- tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies | 2 +- tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7ed5f94803..aec40404c9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1299,7 +1299,7 @@ static virQEMUCapsObjectTypeProps virQEMUCapsDeviceProps[] = { { "vfio-pci", virQEMUCapsDevicePropsVfioPCI, ARRAY_CARDINALITY(virQEMUCapsDevicePropsVfioPCI), QEMU_CAPS_DEVICE_VFIO_PCI }, -{ "scsi-disk", virQEMUCapsDevicePropsSCSIDisk, +{ "scsi-hd", virQEMUCapsDevicePropsSCSIDisk, ARRAY_CARDINALITY(virQEMUCapsDevicePropsSCSIDisk), -1 }, { "ide-drive", virQEMUCapsDevicePropsIDEDrive, diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies index 88bc93be3a..95f3c45f2f 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies @@ -1465,7 +1465,7 @@ { "execute": "device-list-properties", "arguments": { -"typename": "scsi-disk" +"typename": "scsi-hd" }, "id": "libvirt-16" } diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies index ea04d55f2a..ef7b3021e7 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies @@ -1494,7 +1494,7 @@ { "execute": "device-list-properties", "arguments": { -"typename": "scsi-disk" +"typename": "scsi-hd" }, "id": "libvirt-16" } diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies index 1261a2bdc1..dfa1d3e623 100644 --- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies @@ -1503,7 +1503,7 @@ { "execute": "device-list-properties", "arguments": { -"typename": "scsi-disk" +"typename": "scsi-hd" }, "id": "libvirt-16" } diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies index b6efe1d3a1..adf015bf19 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies +++
[libvirt] [PATCH v2 03/32] qemu: capabilities: Probe caps for 'ide-hd' instead of 'ide-drive'
Since commit a4cda054e7 we are using 'ide-hd' and 'ide-cd' instead of 'ide-drive'. We also should probe capabilities for 'ide-hd' instead of 'ide-drive'. It is safe to do as 'ide-drive' is the common denominator of both 'ide-hd' and 'ide-cd' so all the properties were common. For now the test data are modified by just changing the appropriate type when probing for caps. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 2 +- tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.aarch64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.ppc64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.s390x.replies | 2 +- tests/qemucapabilitiesdata/caps_2.10.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.11.0.s390x.replies | 2 +- tests/qemucapabilitiesdata/caps_2.11.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies | 2 +- tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.4.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.5.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.6.0.aarch64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.6.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_2.6.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.7.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_2.7.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.8.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_2.8.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_2.9.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_2.9.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_2.9.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies| 2 +- tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies| 2 +- tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies | 2 +- tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies | 2 +- tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies | 2 +- tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index aec40404c9..3d7d05cd99 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1302,7 +1302,7 @@ static virQEMUCapsObjectTypeProps virQEMUCapsDeviceProps[] = { { "scsi-hd", virQEMUCapsDevicePropsSCSIDisk, ARRAY_CARDINALITY(virQEMUCapsDevicePropsSCSIDisk), -1 }, -{ "ide-drive", virQEMUCapsDevicePropsIDEDrive, +{ "ide-hd", virQEMUCapsDevicePropsIDEDrive, ARRAY_CARDINALITY(virQEMUCapsDevicePropsIDEDrive), -1 }, { "PIIX4_PM", virQEMUCapsDevicePropsPiix4PM, diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies index 95f3c45f2f..a62b4e98f4 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.replies @@ -1547,7 +1547,7 @@ { "execute": "device-list-properties", "arguments": { -"typename": "ide-drive" +"typename": "ide-hd" }, "id": "libvirt-17" } diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies index ef7b3021e7..3253ba635a 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.replies @@ -1576,7 +1576,7 @@ { "execute": "device-list-properties", "arguments": { -"typename": "ide-drive" +"typename": "ide-hd" }, "id": "libvirt-17" } diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies index dfa1d3e623..4789a11f55 100644 --- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.replies @@ -1585,7 +1585,7 @@ { "execute": "device-list-properties", "arguments": { -"typename": "ide-drive" +"typename": "ide-hd" }, "id": "libvirt-17" } diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies index adf015bf19..42b7278fe1 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.replies +++
[libvirt] [PATCH v2 01/32] tests: qemucaps: Make fake 'microcodeVersion' depend on filename instead of length
To avoid changes to the filled in microcode in case we change the caps replies file for any reason make the number depend on the filename. Signed-off-by: Peter Krempa --- .../qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 2 +- .../caps_2.10.0.aarch64.xml | 2 +- .../qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.10.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.11.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 2 +- .../caps_2.12.0.aarch64.xml | 2 +- .../qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.12.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.6.0.aarch64.xml | 2 +- tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 2 +- tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 2 +- tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 2 +- tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 2 +- tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 2 +- tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_3.0.0.x86_64.xml | 2 +- tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_3.1.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 +- tests/qemucapabilitiestest.c| 17 + 33 files changed, 45 insertions(+), 36 deletions(-) diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml index fc0bc6e10c..3c9a474b5b 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml @@ -98,7 +98,7 @@ 1005003 0 - 48498 + 43100763 x86_64 diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml index c939cec5e8..528af43a6d 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml @@ -103,7 +103,7 @@ 1006000 0 - 46667 + 43100761 x86_64 diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml index 509d6ca098..ddc06959ca 100644 --- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml @@ -105,7 +105,7 @@ 1007000 0 - 52111 + 43100762 x86_64 diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml index 426c4654fb..7c65353ba5 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml @@ -121,7 +121,7 @@ 2001001 0 - 60857 + 43100758 x86_64 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml index 7061ba8f7e..9f6676a2b8 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml @@ -154,7 +154,7 @@ 201 0 - 305067 + 61700805 (v2.10.0) aarch64 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml index 2a48b63efe..d4cc446d0b 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -153,7 +153,7 @@ 201 0 - 384412 + 42900805 (v2.10.0) ppc64 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml index 180a688ba2..9c88b919a4 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -117,7 +117,7 @@ 201 0 - 306247 + 39100805 s390x diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml index 8ced5f301d..2941743f94 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -195,7 +195,7 @@ 201 0 - 364616 + 43100805 (v2.10.0) x86_64 diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml index
[libvirt] [PATCH v2 00/32] qemu: add support for 'device_id' of SCSI disks (blockdev-add saga)
Now that qemu has commited the patches this contains real caps data and also fixes few merge conflicts with patches pushed upstream. Peter Krempa (32): tests: qemucaps: Make fake 'microcodeVersion' depend on filename instead of length qemu: capabilities: Probe caps for 'scsi-hd' instead of 'scsi-disk' qemu: capabilities: Probe caps for 'ide-hd' instead of 'ide-drive' tests: qemuxml: Add a common test file for the 'virtio-scsi' controller tests: qemu: Remove 'disk-scsi-virtio-scsi' test tests: qemuxml: Merge 'num-queues' variant of 'virtio-scsi' test into the common file tests: qemuxml: Merge 'cmd_per_lun' variant of 'virtio-scsi' test into the common file tests: qemuxml: Merge 'max_sectors' variant of 'virtio-scsi' test into the common file tests: qemuxml: Merge 'ioeventfd' variant of 'virtio-scsi' test into the common file tests: qemuxml2argv: Use real caps when auto-generating SCSI controller type tests: qemuxml2argv: Remove testing of post startup change to 'cachemode' for shared disks tests: qemuxml2argv: Remove the 'after startup XML' testing machinery tests: qemuxml2argv: Move cases from 'disk-shared-locking' into 'disk-shared' tests: qemu: Rename 'disk-scsi-device' to 'disk-scsi' tests: qemuxml2argv: Modernize 'disk-scsi' test tests: qemu: Merge 'disk-scsi-megasas' test into 'disk-scsi' tests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi' tests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi' tests: qemuxml2argv: Use 1.5.3 version for very old state in 'disk-cache' tests: qemuxml2argv: Modernize virtio-scsi iothread tests tests: qemuxml2argv: Remove 'disk-virtio-scsi-ccw' test qemu: caps: Always assume presence of 'scsi-hd' and 'scsi-cd' device qemu: caps: Always assume presence of 'ide-hd' and 'ide-cd' devices qemu: command: Use correct type for switch in qemuBuildDiskDeviceStr tests: qemuxml2argv: Add CDROM disks for all untested buses qemu: Forbid cdroms on virtio bus qemu: command: Drop formatting of 'media=cdrom' from -drive tests: qemuxml2argv: Add a 'serial' value for a SCSI disk test: qemucaps: Update caps with scsi 'device_id' property qemu: caps: Introduce capability for 'device_id' property of 'scsi-disk' qemu: Use the 'device_id' property of SCSI disks to avoid regressing qemu: caps: Add lockout for -blockdev if QEMU_CAPS_SCSI_DISK_DEVICE_ID is not present src/qemu/qemu_capabilities.c | 13 +- src/qemu/qemu_capabilities.h |5 +- src/qemu/qemu_command.c | 78 +- src/qemu/qemu_domain.c|8 + tests/Makefile.am |1 - .../caps_1.5.3.x86_64.replies |4 +- .../caps_1.5.3.x86_64.xml |4 +- .../caps_1.6.0.x86_64.replies |4 +- .../caps_1.6.0.x86_64.xml |4 +- .../caps_1.7.0.x86_64.replies |4 +- .../caps_1.7.0.x86_64.xml |4 +- .../caps_2.1.1.x86_64.replies |4 +- .../caps_2.1.1.x86_64.xml |4 +- .../caps_2.10.0.aarch64.replies |4 +- .../caps_2.10.0.aarch64.xml |4 +- .../caps_2.10.0.ppc64.replies |4 +- .../caps_2.10.0.ppc64.xml |4 +- .../caps_2.10.0.s390x.replies |4 +- .../caps_2.10.0.s390x.xml |3 +- .../caps_2.10.0.x86_64.replies|4 +- .../caps_2.10.0.x86_64.xml|4 +- .../caps_2.11.0.s390x.replies |4 +- .../caps_2.11.0.s390x.xml |3 +- .../caps_2.11.0.x86_64.replies|4 +- .../caps_2.11.0.x86_64.xml|4 +- .../caps_2.12.0.aarch64.replies |4 +- .../caps_2.12.0.aarch64.xml |4 +- .../caps_2.12.0.ppc64.replies |4 +- .../caps_2.12.0.ppc64.xml |4 +- .../caps_2.12.0.s390x.replies |4 +- .../caps_2.12.0.s390x.xml |3 +- .../caps_2.12.0.x86_64.replies|4 +- .../caps_2.12.0.x86_64.xml|4 +- .../caps_2.4.0.x86_64.replies |4 +- .../caps_2.4.0.x86_64.xml |4 +- .../caps_2.5.0.x86_64.replies |4 +- .../caps_2.5.0.x86_64.xml |4 +- .../caps_2.6.0.aarch64.replies|4 +- .../caps_2.6.0.aarch64.xml|4 +- .../caps_2.6.0.ppc64.replies |4 +- .../qemucapabilitiesdata/caps_2.6.0.ppc64.xml |4 +- .../caps_2.6.0.x86_64.replies |4 +- .../caps_2.6.0.x86_64.xml |4 +- .../caps_2.7.0.s390x.replies |4 +-
Re: [libvirt] [PATCH RFC] qemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root
On Mon, Feb 04, 2019 at 04:32:52PM +0100, Peter Krempa wrote: > On Mon, Feb 04, 2019 at 16:26:02 +0100, Peter Krempa wrote: > > It will not work. This breaks qemu capabilities probing as a user. > > --- > > src/qemu/qemu_capabilities.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c > > index 7ed5f94803..81ef0357e7 100644 > > --- a/src/qemu/qemu_capabilities.c > > +++ b/src/qemu/qemu_capabilities.c > > @@ -4524,7 +4524,8 @@ > > virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, > > #if WITH_CAPNG > > /* QEMU might run into permission issues, e.g. /dev/sev (0600), > > override > > * them just for the purpose of probing */ > > -virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); > > +if (geteuid() == 0) > > Possibly replacing this with driver->privileged for the qemu driver but > that is not easily accessible. It doesn't really matter as privileged == (geteuid() == 0) since we purged the hack for Solaris that tried to run privileged libvirtd as non-root for Xen. We've got many other cases using geteuid() == 0 where they cannot access the 'privileged' flag alrady. Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC] qemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root
On Mon, Feb 04, 2019 at 16:26:02 +0100, Peter Krempa wrote: > It will not work. This breaks qemu capabilities probing as a user. > --- > src/qemu/qemu_capabilities.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c > index 7ed5f94803..81ef0357e7 100644 > --- a/src/qemu/qemu_capabilities.c > +++ b/src/qemu/qemu_capabilities.c > @@ -4524,7 +4524,8 @@ > virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, > #if WITH_CAPNG > /* QEMU might run into permission issues, e.g. /dev/sev (0600), override > * them just for the purpose of probing */ > -virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); > +if (geteuid() == 0) Possibly replacing this with driver->privileged for the qemu driver but that is not easily accessible. > +virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); > #endif > > virCommandSetGID(cmd->cmd, cmd->runGid); > -- > 2.20.1 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH RFC] qemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root
It will not work. This breaks qemu capabilities probing as a user. --- src/qemu/qemu_capabilities.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7ed5f94803..81ef0357e7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4524,7 +4524,8 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, #if WITH_CAPNG /* QEMU might run into permission issues, e.g. /dev/sev (0600), override * them just for the purpose of probing */ -virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); +if (geteuid() == 0) +virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE); #endif virCommandSetGID(cmd->cmd, cmd->runGid); -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/10] conf: snapshot: fix comment in _virDomainSnapshotDef
On Thu, Dec 27, 2018 at 01:20:43PM +0300, Nikolay Shirokovskiy wrote: Signed-off-by: Nikolay Shirokovskiy --- src/conf/snapshot_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Ján Tomko Jano signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Refresh state before starting the VCPUs
On Mon, Feb 04, 2019 at 14:41:05 +0100, Marc Hartmayer wrote: > On Mon, Feb 04, 2019 at 02:37 PM +0100, Marc Hartmayer > wrote: > > On Mon, Feb 04, 2019 at 01:41 PM +0100, Peter Krempa > > wrote: > >> On Mon, Feb 04, 2019 at 13:36:24 +0100, Marc Hartmayer wrote: > >>> For normal starts (no incoming migration) the refresh of the QEMU > >>> state must be done before the VCPUs getting started since otherwise > >>> there might be a race condition between a possible shutdown of the > >>> guest OS and the QEMU monitor queries. > >>> > >>> This fixes "qemu: migration: Refresh device information after > >>> transferring state" (93db7eea1b864). > >>> > >>> Signed-off-by: Marc Hartmayer > >>> --- > >>> src/qemu/qemu_process.c | 20 +++- > >>> 1 file changed, 11 insertions(+), 9 deletions(-) > >>> > >>> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c > >>> index dace5aaca102..2a3763f40d49 100644 > >>> --- a/src/qemu/qemu_process.c > >>> +++ b/src/qemu/qemu_process.c > >>> @@ -6929,10 +6929,17 @@ qemuProcessStart(virConnectPtr conn, > >>> } > >>> relabel = true; > >>> > >>> -if (incoming && > >>> -incoming->deferredURI && > >>> -qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) > >>> < 0) > >>> -goto stop; > >>> +if (incoming) { > >>> +if (incoming->deferredURI && > >>> +qemuMigrationDstRun(driver, vm, incoming->deferredURI, > >>> asyncJob) < 0) > >>> +goto stop; > >>> +} else { > >> > >> This logic does not seem right ... > > > > I’m not familiar with the usage of this function for migration… so > > there's a good chance I'm missing something. > > > >> > >>> +/* Refresh state of devices from QEMU. During migration this > >>> + * needs to happen after the state information is fully > >>> + * transferred. */ > >> > >> as this comment clearly states that this should happen after > >> migration. > > > > Is qemuProcessFinishStartup > > qemuProcessRefreshState > > > not called explicitly in qemuMigrationFinish > > for migration? > > Yes it is, in this case the comment is wrong/misleading so it should be fixed. > >> > >> Here it would happen only when migration is not done. > > > > Without this patch qemuProcessRefreshState is called after > > qemuProcessFinishStartup if (!incoming). Now it’s called directly before > > qemuProcessFinishStartup if (!incoming). Why should this be wrong now? > > What happens in qemuProcessFinishStartup? > > > > Before your change in 93db7eea1b86408e the function call > > 'qemuProcessRefreshState' was done in qemuProcessFinishStartup (without > > any condition). As I've said in the other thread I think this fix is okay if we fix the comment. I'll do this in a moment so you don't need to send another patch. signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Refresh state before starting the VCPUs
On Mon, Feb 04, 2019 at 13:46:15 +, Daniel Berrange wrote: > On Mon, Feb 04, 2019 at 01:36:24PM +0100, Marc Hartmayer wrote: > > For normal starts (no incoming migration) the refresh of the QEMU > > state must be done before the VCPUs getting started since otherwise > > there might be a race condition between a possible shutdown of the > > guest OS and the QEMU monitor queries. > > > > This fixes "qemu: migration: Refresh device information after > > transferring state" (93db7eea1b864). > > Hmm, this is the second bug that this patch has been responsible for > now > > It has also resulted in a deadlock in libguestfs during startup > when there is a chardev in blocking connect mode in QEMU. If the > guest writes data to the chardev before it is accepted by the > server libvirt can deadlock in startup as QEMU is blocked and > won't respond to QMP. The core problem is that the startup code QEMU allowing a guest to overwhelm it by spamming too much data which results in a event loop lock up should be fixed as well regardless of this. > must not rely on being able to use QMP /after/ the vCPUs have > been started untill the virDomainCreate API has completed > > https://bugzilla.redhat.com/show_bug.cgi?id=1661940 > > IMHO we need to just revert that original broken commit entirely > and find a different way to fix the problem it was attacking. I went through the code, and it seems that this is in fact the correct fix. > > > > > Signed-off-by: Marc Hartmayer > > --- > > src/qemu/qemu_process.c | 20 +++- > > 1 file changed, 11 insertions(+), 9 deletions(-) > > > > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c > > index dace5aaca102..2a3763f40d49 100644 > > --- a/src/qemu/qemu_process.c > > +++ b/src/qemu/qemu_process.c > > @@ -6929,10 +6929,17 @@ qemuProcessStart(virConnectPtr conn, > > } > > relabel = true; > > > > -if (incoming && > > -incoming->deferredURI && > > -qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < > > 0) > > -goto stop; > > +if (incoming) { > > +if (incoming->deferredURI && > > +qemuMigrationDstRun(driver, vm, incoming->deferredURI, > > asyncJob) < 0) > > +goto stop; > > +} else { > > +/* Refresh state of devices from QEMU. During migration this > > + * needs to happen after the state information is fully > > + * transferred. */ We just should mention that during migration the same code is called from 'qemuMigrationDstFinish' right before starting the vCPUs. In that function it's also executed before vCPUs are started so it's okay to move it here. I'll do the adjustment to the comment and push the patch. signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Refresh state before starting the VCPUs
On Mon, Feb 04, 2019 at 01:36:24PM +0100, Marc Hartmayer wrote: > For normal starts (no incoming migration) the refresh of the QEMU > state must be done before the VCPUs getting started since otherwise > there might be a race condition between a possible shutdown of the > guest OS and the QEMU monitor queries. > > This fixes "qemu: migration: Refresh device information after > transferring state" (93db7eea1b864). Hmm, this is the second bug that this patch has been responsible for now It has also resulted in a deadlock in libguestfs during startup when there is a chardev in blocking connect mode in QEMU. If the guest writes data to the chardev before it is accepted by the server libvirt can deadlock in startup as QEMU is blocked and won't respond to QMP. The core problem is that the startup code must not rely on being able to use QMP /after/ the vCPUs have been started untill the virDomainCreate API has completed https://bugzilla.redhat.com/show_bug.cgi?id=1661940 IMHO we need to just revert that original broken commit entirely and find a different way to fix the problem it was attacking. > > Signed-off-by: Marc Hartmayer > --- > src/qemu/qemu_process.c | 20 +++- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c > index dace5aaca102..2a3763f40d49 100644 > --- a/src/qemu/qemu_process.c > +++ b/src/qemu/qemu_process.c > @@ -6929,10 +6929,17 @@ qemuProcessStart(virConnectPtr conn, > } > relabel = true; > > -if (incoming && > -incoming->deferredURI && > -qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0) > -goto stop; > +if (incoming) { > +if (incoming->deferredURI && > +qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) > < 0) > +goto stop; > +} else { > +/* Refresh state of devices from QEMU. During migration this > + * needs to happen after the state information is fully > + * transferred. */ > +if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) > +goto stop; > +} > > if (qemuProcessFinishStartup(driver, vm, asyncJob, > !(flags & VIR_QEMU_PROCESS_START_PAUSED), > @@ -6945,11 +6952,6 @@ qemuProcessStart(virConnectPtr conn, > /* Keep watching qemu log for errors during incoming migration, > otherwise > * unset reporting errors from qemu log. */ > qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); > - > -/* Refresh state of devices from qemu. During migration this needs to > - * happen after the state information is fully transferred. */ > -if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) > -goto stop; > } > > ret = 0; > -- > 2.17.0 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Refresh state before starting the VCPUs
On Mon, Feb 04, 2019 at 02:37 PM +0100, Marc Hartmayer wrote: > On Mon, Feb 04, 2019 at 01:41 PM +0100, Peter Krempa > wrote: >> On Mon, Feb 04, 2019 at 13:36:24 +0100, Marc Hartmayer wrote: >>> For normal starts (no incoming migration) the refresh of the QEMU >>> state must be done before the VCPUs getting started since otherwise >>> there might be a race condition between a possible shutdown of the >>> guest OS and the QEMU monitor queries. >>> >>> This fixes "qemu: migration: Refresh device information after >>> transferring state" (93db7eea1b864). >>> >>> Signed-off-by: Marc Hartmayer >>> --- >>> src/qemu/qemu_process.c | 20 +++- >>> 1 file changed, 11 insertions(+), 9 deletions(-) >>> >>> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c >>> index dace5aaca102..2a3763f40d49 100644 >>> --- a/src/qemu/qemu_process.c >>> +++ b/src/qemu/qemu_process.c >>> @@ -6929,10 +6929,17 @@ qemuProcessStart(virConnectPtr conn, >>> } >>> relabel = true; >>> >>> -if (incoming && >>> -incoming->deferredURI && >>> -qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < >>> 0) >>> -goto stop; >>> +if (incoming) { >>> +if (incoming->deferredURI && >>> +qemuMigrationDstRun(driver, vm, incoming->deferredURI, >>> asyncJob) < 0) >>> +goto stop; >>> +} else { >> >> This logic does not seem right ... > > I’m not familiar with the usage of this function for migration… so > there's a good chance I'm missing something. > >> >>> +/* Refresh state of devices from QEMU. During migration this >>> + * needs to happen after the state information is fully >>> + * transferred. */ >> >> as this comment clearly states that this should happen after >> migration. > > Is qemuProcessFinishStartup qemuProcessRefreshState > not called explicitly in qemuMigrationFinish > for migration? > >> >> Here it would happen only when migration is not done. > > Without this patch qemuProcessRefreshState is called after > qemuProcessFinishStartup if (!incoming). Now it’s called directly before > qemuProcessFinishStartup if (!incoming). Why should this be wrong now? > What happens in qemuProcessFinishStartup? > > Before your change in 93db7eea1b86408e the function call > 'qemuProcessRefreshState' was done in qemuProcessFinishStartup (without > any condition). > > Thanks. > >> >> >>> +if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) >>> +goto stop; >>> +} >>> >>> if (qemuProcessFinishStartup(driver, vm, asyncJob, >>> !(flags & VIR_QEMU_PROCESS_START_PAUSED), >>> @@ -6945,11 +6952,6 @@ qemuProcessStart(virConnectPtr conn, >>> /* Keep watching qemu log for errors during incoming migration, >>> otherwise >>> * unset reporting errors from qemu log. */ >>> qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); >>> - >>> -/* Refresh state of devices from qemu. During migration this needs >>> to >>> - * happen after the state information is fully transferred. */ >>> -if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) >>> -goto stop; >>> } >>> >>> ret = 0; >>> -- >>> 2.17.0 >>> > -- > Kind regards / Beste Grüße >Marc Hartmayer > > IBM Deutschland Research & Development GmbH > Vorsitzende des Aufsichtsrats: Matthias Hartmann > Geschäftsführung: Dirk Wittkopp > Sitz der Gesellschaft: Böblingen > Registergericht: Amtsgericht Stuttgart, HRB 243294 -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Matthias Hartmann Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Refresh state before starting the VCPUs
On Mon, Feb 04, 2019 at 01:41 PM +0100, Peter Krempa wrote: > On Mon, Feb 04, 2019 at 13:36:24 +0100, Marc Hartmayer wrote: >> For normal starts (no incoming migration) the refresh of the QEMU >> state must be done before the VCPUs getting started since otherwise >> there might be a race condition between a possible shutdown of the >> guest OS and the QEMU monitor queries. >> >> This fixes "qemu: migration: Refresh device information after >> transferring state" (93db7eea1b864). >> >> Signed-off-by: Marc Hartmayer >> --- >> src/qemu/qemu_process.c | 20 +++- >> 1 file changed, 11 insertions(+), 9 deletions(-) >> >> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c >> index dace5aaca102..2a3763f40d49 100644 >> --- a/src/qemu/qemu_process.c >> +++ b/src/qemu/qemu_process.c >> @@ -6929,10 +6929,17 @@ qemuProcessStart(virConnectPtr conn, >> } >> relabel = true; >> >> -if (incoming && >> -incoming->deferredURI && >> -qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < >> 0) >> -goto stop; >> +if (incoming) { >> +if (incoming->deferredURI && >> +qemuMigrationDstRun(driver, vm, incoming->deferredURI, >> asyncJob) < 0) >> +goto stop; >> +} else { > > This logic does not seem right ... I’m not familiar with the usage of this function for migration… so there's a good chance I'm missing something. > >> +/* Refresh state of devices from QEMU. During migration this >> + * needs to happen after the state information is fully >> + * transferred. */ > > as this comment clearly states that this should happen after > migration. Is qemuProcessFinishStartup not called explicitly in qemuMigrationFinish for migration? > > Here it would happen only when migration is not done. Without this patch qemuProcessRefreshState is called after qemuProcessFinishStartup if (!incoming). Now it’s called directly before qemuProcessFinishStartup if (!incoming). Why should this be wrong now? What happens in qemuProcessFinishStartup? Before your change in 93db7eea1b86408e the function call 'qemuProcessRefreshState' was done in qemuProcessFinishStartup (without any condition). Thanks. > > >> +if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) >> +goto stop; >> +} >> >> if (qemuProcessFinishStartup(driver, vm, asyncJob, >> !(flags & VIR_QEMU_PROCESS_START_PAUSED), >> @@ -6945,11 +6952,6 @@ qemuProcessStart(virConnectPtr conn, >> /* Keep watching qemu log for errors during incoming migration, >> otherwise >> * unset reporting errors from qemu log. */ >> qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); >> - >> -/* Refresh state of devices from qemu. During migration this needs >> to >> - * happen after the state information is fully transferred. */ >> -if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) >> -goto stop; >> } >> >> ret = 0; >> -- >> 2.17.0 >> -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Matthias Hartmann Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
On Mon, Feb 04, 2019 at 09:58:47AM +0100, Michal Privoznik wrote: > On 2/1/19 7:04 PM, Daniel Henrique Barboza wrote: > > Hi, > > > > I'm facing a strange behavior when running Libvirt from source code, > > latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU > > guest - which is using VFIO and GPU passthrough - breaks on boot when > > trying to allocate a DMA window inside KVM. > > > > Debugging the code, I've found out that the problem is related to the > > process > > not having CAP_IPC_LOCK - at least from the host kernel perspective. > > > > This is strange because: > > > > - the same VM running directly from QEMU command line works > > - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) > > also works > > > > What am I missing? My understanding on Linux process is that a process > > running as root should inherit the same capabilities of the user, which > > includes > > CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock > > to it ... right? > > No. Ideally, you trust libvirt and want it to manage devices on your system > thus it needs all the capabilities. But qemu spawn by libvirt should have no > capabilities as libvirt set up everything that's needed for qemu to run. But > this is hard to get right - qemu changes and so does the capabilities it may > require (these depend on domain configuration anyway). Therefore, it is > possible to set libvirt so it does not drop capabilities for qemu process - > see clear_emulator_capabilities in qemu.conf - but then libvirt can't > guarantee that a compromised qemu does no harm. In my case it is not a matter of risk of a malicious guest, it is that the device cannot utilize the host device *unless* it has the 'lock' capability. > > This corresponds with your finding about ./configure - if there is no > libncap-ng found there's no way for libvirt to drop capabilities and thus it > doesn't do that. > > Michal > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
+ Kamal and Marcel On Mon, Feb 04, 2019 at 09:58:47AM +0100, Michal Privoznik wrote: > On 2/1/19 7:04 PM, Daniel Henrique Barboza wrote: > > Hi, > > > > I'm facing a strange behavior when running Libvirt from source code, > > latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU > > guest - which is using VFIO and GPU passthrough - breaks on boot when > > trying to allocate a DMA window inside KVM. > > > > Debugging the code, I've found out that the problem is related to the > > process > > not having CAP_IPC_LOCK - at least from the host kernel perspective. > > > > This is strange because: > > > > - the same VM running directly from QEMU command line works > > - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) > > also works > > > > What am I missing? My understanding on Linux process is that a process > > running as root should inherit the same capabilities of the user, which > > includes > > CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock > > to it ... right? > > No. Ideally, you trust libvirt and want it to manage devices on your system > thus it needs all the capabilities. But qemu spawn by libvirt should have no > capabilities as libvirt set up everything that's needed for qemu to run. But > this is hard to get right - qemu changes and so does the capabilities it may > require (these depend on domain configuration anyway). Therefore, it is > possible to set libvirt so it does not drop capabilities for qemu process - > see clear_emulator_capabilities in qemu.conf - but then libvirt can't > guarantee that a compromised qemu does no harm. In my case it is not a matter of risk of a malicious guest, it is that the device cannot utilize the host device *unless* it has the 'lock' capability. > > This corresponds with your finding about ./configure - if there is no > libncap-ng found there's no way for libvirt to drop capabilities and thus it > doesn't do that. > > Michal > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 0/2] guests: Install isoinfo for virt-manager
On Mon, Feb 04, 2019 at 01:51:02PM +0100, Andrea Bolognani wrote: > Andrea Bolognani (2): > guests: Add mapping for isoinfo > guests: Install isoinfo for virt-manager > > guests/vars/mappings.yml | 4 > guests/vars/projects/virt-manager.yml | 1 + > 2 files changed, 5 insertions(+) Reviewed-by: Daniel P. Berrangé Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [jenkins-ci PATCH 0/2] guests: Install isoinfo for virt-manager
Andrea Bolognani (2): guests: Add mapping for isoinfo guests: Install isoinfo for virt-manager guests/vars/mappings.yml | 4 guests/vars/projects/virt-manager.yml | 1 + 2 files changed, 5 insertions(+) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [jenkins-ci PATCH 2/2] guests: Install isoinfo for virt-manager
Signed-off-by: Andrea Bolognani --- guests/vars/projects/virt-manager.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/guests/vars/projects/virt-manager.yml b/guests/vars/projects/virt-manager.yml index 9405fc6..0b7266a 100644 --- a/guests/vars/projects/virt-manager.yml +++ b/guests/vars/projects/virt-manager.yml @@ -2,6 +2,7 @@ packages: - gtk-update-icon-cache - intltool + - isoinfo - python3 - python3-gi - python3-libxml2 -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [jenkins-ci PATCH 1/2] guests: Add mapping for isoinfo
Signed-off-by: Andrea Bolognani --- guests/vars/mappings.yml | 4 1 file changed, 4 insertions(+) diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml index 238ae88..84543c4 100644 --- a/guests/vars/mappings.yml +++ b/guests/vars/mappings.yml @@ -197,6 +197,10 @@ mappings: deb: open-iscsi rpm: iscsi-initiator-utils + isoinfo: +default: genisoimage +FreeBSD: cdrkit + java: deb: openjdk-8-jre-headless pkg: openjdk8-jre -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Refresh state before starting the VCPUs
On Mon, Feb 04, 2019 at 13:36:24 +0100, Marc Hartmayer wrote: > For normal starts (no incoming migration) the refresh of the QEMU > state must be done before the VCPUs getting started since otherwise > there might be a race condition between a possible shutdown of the > guest OS and the QEMU monitor queries. > > This fixes "qemu: migration: Refresh device information after > transferring state" (93db7eea1b864). > > Signed-off-by: Marc Hartmayer > --- > src/qemu/qemu_process.c | 20 +++- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c > index dace5aaca102..2a3763f40d49 100644 > --- a/src/qemu/qemu_process.c > +++ b/src/qemu/qemu_process.c > @@ -6929,10 +6929,17 @@ qemuProcessStart(virConnectPtr conn, > } > relabel = true; > > -if (incoming && > -incoming->deferredURI && > -qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0) > -goto stop; > +if (incoming) { > +if (incoming->deferredURI && > +qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) > < 0) > +goto stop; > +} else { This logic does not seem right ... > +/* Refresh state of devices from QEMU. During migration this > + * needs to happen after the state information is fully > + * transferred. */ as this comment clearly states that this should happen after migration. Here it would happen only when migration is not done. > +if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) > +goto stop; > +} > > if (qemuProcessFinishStartup(driver, vm, asyncJob, > !(flags & VIR_QEMU_PROCESS_START_PAUSED), > @@ -6945,11 +6952,6 @@ qemuProcessStart(virConnectPtr conn, > /* Keep watching qemu log for errors during incoming migration, > otherwise > * unset reporting errors from qemu log. */ > qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); > - > -/* Refresh state of devices from qemu. During migration this needs to > - * happen after the state information is fully transferred. */ > -if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) > -goto stop; > } > > ret = 0; > -- > 2.17.0 > signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: Refresh state before starting the VCPUs
For normal starts (no incoming migration) the refresh of the QEMU state must be done before the VCPUs getting started since otherwise there might be a race condition between a possible shutdown of the guest OS and the QEMU monitor queries. This fixes "qemu: migration: Refresh device information after transferring state" (93db7eea1b864). Signed-off-by: Marc Hartmayer --- src/qemu/qemu_process.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index dace5aaca102..2a3763f40d49 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6929,10 +6929,17 @@ qemuProcessStart(virConnectPtr conn, } relabel = true; -if (incoming && -incoming->deferredURI && -qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0) -goto stop; +if (incoming) { +if (incoming->deferredURI && +qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0) +goto stop; +} else { +/* Refresh state of devices from QEMU. During migration this + * needs to happen after the state information is fully + * transferred. */ +if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) +goto stop; +} if (qemuProcessFinishStartup(driver, vm, asyncJob, !(flags & VIR_QEMU_PROCESS_START_PAUSED), @@ -6945,11 +6952,6 @@ qemuProcessStart(virConnectPtr conn, /* Keep watching qemu log for errors during incoming migration, otherwise * unset reporting errors from qemu log. */ qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); - -/* Refresh state of devices from qemu. During migration this needs to - * happen after the state information is fully transferred. */ -if (qemuProcessRefreshState(driver, vm, asyncJob) < 0) -goto stop; } ret = 0; -- 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] qemu: Assume migration with a network disk migration is safe
On Tue, Jan 29, 2019 at 09:56:46AM +0100, Michal Privoznik wrote: > If a domain has a disk that is type='network' we require specific > cache mode to allow migration with it (either 'directsync' or > 'none'). This doesn't make much sense since network disks are > supposed to be safe to migrate by default. > > At the same time, we should be checking for the actual source > type, not apparent type set in the domain XML. > > Signed-off-by: Michal Privoznik > --- > > v2 of: > > https://www.redhat.com/archives/libvir-list/2019-January/msg01070.html > > diff to v1: > - Allow just every network disk > - Check for actual disk type not the apparent one > > src/qemu/qemu_migration.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Reviewed-by: Erik Skultety -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
On Fri, Feb 01, 2019 at 07:40:36PM -0200, Daniel Henrique Barboza wrote: > Update: I've figured it out. > > The bug here was that, even running as root, I was getting errors like: > > error : virQEMUCapsNewForBinaryInternal:4687 : internal error: Failed to > probe QEMU binary with > QMP: libvirt: error : prctl failed to enable 'dac_override' in the AMBIENT > set: > Operation not permitted Being responsible for the latest changes wrt to capabilities, this error itself is very strange because the prctl man page says the following about EPERM errno: "option is PR_CAP_AMBIENT and arg2 is PR_CAP_AMBIENT_RAISE, but either the capability specified in arg3 is not present in the process's permitted and inheritable capability sets, or the PR_CAP_AMBIENT_LOWER securebit has been set." So I'm wondering how can that be since that prctl call happens after we applied the capabilities we want with capng_apply. Just out of curiosity, what happens if you move the whole PR_CAP_AMBIENT at the very end of virSetUIDGIDWithCaps function? Does it change anything? Thanks, Erik > > The reason is that the host has libcap-ng installed. ./configure uses it if > available, > setting WITH_CAPNG in the code. I am unsure if this has something to do with > the libcap-ng configuration in this system I'm using or if there is > something > missing in the Libvirt code, but the spawned QEMU process isn't inheriting > the > capabilities it should have. > > Disabling support of this lib with "--with-capng=no" in autogen.sh and > rebuilding Libvirt fixed the problem. I was even able to see more NUMA > nodes than I was before using the system libvirt (which is the original > bug I am/was investigating). > > > Thanks! > > > > > > On 2/1/19 4:04 PM, Daniel Henrique Barboza wrote: > > Hi, > > > > I'm facing a strange behavior when running Libvirt from source code, > > latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU > > guest - which is using VFIO and GPU passthrough - breaks on boot when > > trying to allocate a DMA window inside KVM. > > > > Debugging the code, I've found out that the problem is related to the > > process > > not having CAP_IPC_LOCK - at least from the host kernel perspective. > > > > This is strange because: > > > > - the same VM running directly from QEMU command line works > > - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) > > also works > > > > What am I missing? My understanding on Linux process is that a process > > running as root should inherit the same capabilities of the user, which > > includes > > CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock > > to it ... right? > > > > > > > > Any help is appreciated. I can provide more details (VM XML for example) > > if necessary. > > > > > > Thanks! > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] scsi-disk: Deprecate device_id fallback to BlockBackend name
On Mon, Feb 04, 2019 at 10:56:28AM +0100, Kevin Wolf wrote: > Am 29.01.2019 um 16:58 hat Daniel P. Berrangé geschrieben: > > On Fri, Jan 25, 2019 at 06:46:53PM +0100, Kevin Wolf wrote: > > > We should never have exposed BlockBackend names to the guest, it's a > > > host detail. Deprecate this behaviour. Users who need to maintain the > > > guest ABI can explicitly set the value with the device_id property. > > > > I don't think we've deprecated things in the past which would cause > > a guest ABI change when finally deleted. > > > > Shouldn't we be instead setting using machine type versioning here, > > so that existing machine types keep using the blk_name() fallback > > forever, while QEMU 4.0+ machine types avoid blk_name() fallback > > immediately. > > I was going to implement this, but then I wondered if that's actually > worthwhile. With -blockdev, you don't get the bad behaviour anyway, and > tools that would select new machine types will hopefully also use new > backend options. > > So if we need to keep the bad behaviour around anyway instead of > completely removing it as I intended originally, maybe -drive vs. > -blockdev is enough to make the difference and we shouldn't change > anything at the device model level at all. Yeah, that rationale sounds ok to me. Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] Configuring pflash devices for OVMF firmware
On 01/02/19 03:49, Ning, Yu wrote: > Thank you both for outlining the changes we have to make in order to > support ROMD memory regions! The only question is whether we should > pass a new flag to HAX_VM_IOCTL_SET_RAM2 for ROMD, so the hypervisor > could respond differently to writes to ROM and ROMD regions. Would > that be useful at all? What would happen if HAXM asked QEMU to > emulate a write to ROM? It's more about backwards compatibility. As far as QEMU is concerned it's okay if all ROM reads are handled as MMIO. However, other emulators may not expect that, so maybe you want to add another flag. Paolo > HAXM didn't implement ROMD support at first, because the guests we > tested could boot without it (including Chrome OS). Now that this > feature has become more popular (and we want to be able to boot > OVMF), I think it's time to get it done. I'd like to get to it after > the Lunar New Year holidays, but if anyone can finish it sooner, I'll > be happy to merge their patch into HAXM. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] scsi-disk: Deprecate device_id fallback to BlockBackend name
Am 29.01.2019 um 16:58 hat Daniel P. Berrangé geschrieben: > On Fri, Jan 25, 2019 at 06:46:53PM +0100, Kevin Wolf wrote: > > We should never have exposed BlockBackend names to the guest, it's a > > host detail. Deprecate this behaviour. Users who need to maintain the > > guest ABI can explicitly set the value with the device_id property. > > I don't think we've deprecated things in the past which would cause > a guest ABI change when finally deleted. > > Shouldn't we be instead setting using machine type versioning here, > so that existing machine types keep using the blk_name() fallback > forever, while QEMU 4.0+ machine types avoid blk_name() fallback > immediately. I was going to implement this, but then I wondered if that's actually worthwhile. With -blockdev, you don't get the bad behaviour anyway, and tools that would select new machine types will hopefully also use new backend options. So if we need to keep the bad behaviour around anyway instead of completely removing it as I intended originally, maybe -drive vs. -blockdev is enough to make the difference and we shouldn't change anything at the device model level at all. Kevin -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
On Mon, Feb 4, 2019 at 9:59 AM Michal Privoznik wrote: > > On 2/1/19 7:04 PM, Daniel Henrique Barboza wrote: > > Hi, > > > > I'm facing a strange behavior when running Libvirt from source code, > > latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU > > guest - which is using VFIO and GPU passthrough - breaks on boot when > > trying to allocate a DMA window inside KVM. > > > > Debugging the code, I've found out that the problem is related to the > > process > > not having CAP_IPC_LOCK - at least from the host kernel perspective. > > > > This is strange because: > > > > - the same VM running directly from QEMU command line works > > - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) > > also works FYI Ubuntu's version is build with capng for the cap dropping feature as discussed in this thread. libcap-ng-dev is installed as build dependencies and "--with-capng" is set on all Linux builds. > > > > What am I missing? My understanding on Linux process is that a process > > running as root should inherit the same capabilities of the user, which > > includes > > CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock > > to it ... right? > > No. Ideally, you trust libvirt and want it to manage devices on your > system thus it needs all the capabilities. But qemu spawn by libvirt > should have no capabilities as libvirt set up everything that's needed > for qemu to run. But this is hard to get right - qemu changes and so > does the capabilities it may require (these depend on domain > configuration anyway). Therefore, it is possible to set libvirt so it > does not drop capabilities for qemu process - see > clear_emulator_capabilities in qemu.conf - but then libvirt can't > guarantee that a compromised qemu does no harm. > > This corresponds with your finding about ./configure - if there is no > libncap-ng found there's no way for libvirt to drop capabilities and > thus it doesn't do that. > > Michal > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tests: Unify qemucaps2xml output files
On 2/1/19 1:29 PM, Andrea Bolognani wrote: Turns out different versions of QEMU on the same architecture produce the same output, so we can have a single output file per architecture instead of duplicating the same data over and over again. Spotted-by: Ján Tomko Signed-off-by: Andrea Bolognani --- ...ps_2.10.0.aarch64.xml => caps.aarch64.xml} | 0 .../{caps_2.10.0.ppc64.xml => caps.ppc64.xml} | 0 ...aps_3.0.0.riscv32.xml => caps.riscv32.xml} | 0 ...aps_3.0.0.riscv64.xml => caps.riscv64.xml} | 0 .../{caps_2.10.0.s390x.xml => caps.s390x.xml} | 0 ...{caps_1.5.3.x86_64.xml => caps.x86_64.xml} | 0 .../qemucaps2xmloutdata/caps_1.6.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_1.7.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_2.1.1.x86_64.xml | 28 --- .../caps_2.10.0.x86_64.xml| 28 --- .../qemucaps2xmloutdata/caps_2.11.0.s390x.xml | 26 - .../caps_2.11.0.x86_64.xml| 28 --- .../caps_2.12.0.aarch64.xml | 27 -- .../qemucaps2xmloutdata/caps_2.12.0.ppc64.xml | 26 - .../qemucaps2xmloutdata/caps_2.12.0.s390x.xml | 26 - .../caps_2.12.0.x86_64.xml| 28 --- .../qemucaps2xmloutdata/caps_2.4.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_2.5.0.x86_64.xml | 28 --- .../caps_2.6.0.aarch64.xml| 27 -- .../qemucaps2xmloutdata/caps_2.6.0.ppc64.xml | 26 - .../qemucaps2xmloutdata/caps_2.6.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_2.7.0.s390x.xml | 26 - .../qemucaps2xmloutdata/caps_2.7.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_2.8.0.s390x.xml | 26 - .../qemucaps2xmloutdata/caps_2.8.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_2.9.0.ppc64.xml | 26 - .../qemucaps2xmloutdata/caps_2.9.0.s390x.xml | 26 - .../qemucaps2xmloutdata/caps_2.9.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_3.0.0.ppc64.xml | 26 - .../qemucaps2xmloutdata/caps_3.0.0.s390x.xml | 26 - .../qemucaps2xmloutdata/caps_3.0.0.x86_64.xml | 28 --- .../qemucaps2xmloutdata/caps_3.1.0.ppc64.xml | 26 - .../qemucaps2xmloutdata/caps_3.1.0.x86_64.xml | 28 --- .../caps_4.0.0.riscv32.xml| 25 - .../caps_4.0.0.riscv64.xml| 25 - .../qemucaps2xmloutdata/caps_4.0.0.x86_64.xml | 28 --- tests/qemucaps2xmltest.c | 4 +-- 37 files changed, 2 insertions(+), 812 deletions(-) rename tests/qemucaps2xmloutdata/{caps_2.10.0.aarch64.xml => caps.aarch64.xml} (100%) rename tests/qemucaps2xmloutdata/{caps_2.10.0.ppc64.xml => caps.ppc64.xml} (100%) rename tests/qemucaps2xmloutdata/{caps_3.0.0.riscv32.xml => caps.riscv32.xml} (100%) rename tests/qemucaps2xmloutdata/{caps_3.0.0.riscv64.xml => caps.riscv64.xml} (100%) rename tests/qemucaps2xmloutdata/{caps_2.10.0.s390x.xml => caps.s390x.xml} (100%) rename tests/qemucaps2xmloutdata/{caps_1.5.3.x86_64.xml => caps.x86_64.xml} (100%) delete mode 100644 tests/qemucaps2xmloutdata/caps_1.6.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_1.7.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.1.1.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.10.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.11.0.s390x.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.11.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.12.0.aarch64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.12.0.ppc64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.12.0.s390x.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.12.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.4.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.5.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.6.0.aarch64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.6.0.ppc64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.6.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.7.0.s390x.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.7.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.8.0.s390x.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.8.0.x86_64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.9.0.ppc64.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.9.0.s390x.xml delete mode 100644 tests/qemucaps2xmloutdata/caps_2.9.0.x86_64.xml delete mode 100644
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
On 2/1/19 7:04 PM, Daniel Henrique Barboza wrote: Hi, I'm facing a strange behavior when running Libvirt from source code, latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU guest - which is using VFIO and GPU passthrough - breaks on boot when trying to allocate a DMA window inside KVM. Debugging the code, I've found out that the problem is related to the process not having CAP_IPC_LOCK - at least from the host kernel perspective. This is strange because: - the same VM running directly from QEMU command line works - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) also works What am I missing? My understanding on Linux process is that a process running as root should inherit the same capabilities of the user, which includes CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock to it ... right? No. Ideally, you trust libvirt and want it to manage devices on your system thus it needs all the capabilities. But qemu spawn by libvirt should have no capabilities as libvirt set up everything that's needed for qemu to run. But this is hard to get right - qemu changes and so does the capabilities it may require (these depend on domain configuration anyway). Therefore, it is possible to set libvirt so it does not drop capabilities for qemu process - see clear_emulator_capabilities in qemu.conf - but then libvirt can't guarantee that a compromised qemu does no harm. This corresponds with your finding about ./configure - if there is no libncap-ng found there's no way for libvirt to drop capabilities and thus it doesn't do that. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] running Libvirt from source code, IPC_LOCK and VFIO
On Fri, Feb 01, 2019 at 07:40:36PM -0200, Daniel Henrique Barboza wrote: > Update: I've figured it out. > > The bug here was that, even running as root, I was getting errors like: > > error : virQEMUCapsNewForBinaryInternal:4687 : internal error: Failed to > probe QEMU binary with > QMP: libvirt: error : prctl failed to enable 'dac_override' in the AMBIENT > set: > Operation not permitted > > The reason is that the host has libcap-ng installed. ./configure uses it if > available, > setting WITH_CAPNG in the code. I am unsure if this has something to do with > the libcap-ng configuration in this system I'm using or if there is > something > missing in the Libvirt code, but the spawned QEMU process isn't inheriting > the > capabilities it should have. > > Disabling support of this lib with "--with-capng=no" in autogen.sh and > rebuilding Libvirt fixed the problem. I was even able to see more NUMA > nodes than I was before using the system libvirt (which is the original > bug I am/was investigating). > > > Thanks! > Hey Daniel, I had the same problem with Mellanox RDMA device as backend for pvrdma device where the mlx5 driver also enforces CAP_IPC_LOCK. So at first i use this as a workaround but i knew that it is not a final approach as it makes a wrong use of memory. Anyways, your tip helps so wanted to say thanks! Yuval > > > > > On 2/1/19 4:04 PM, Daniel Henrique Barboza wrote: > > Hi, > > > > I'm facing a strange behavior when running Libvirt from source code, > > latest upstream, on an Ubuntu 18.04.1 LTS Power 9 server. My QEMU > > guest - which is using VFIO and GPU passthrough - breaks on boot when > > trying to allocate a DMA window inside KVM. > > > > Debugging the code, I've found out that the problem is related to the > > process > > not having CAP_IPC_LOCK - at least from the host kernel perspective. > > > > This is strange because: > > > > - the same VM running directly from QEMU command line works > > - the same VM running in the system Libvirt (v4.0.0, Ubuntu version) > > also works > > > > What am I missing? My understanding on Linux process is that a process > > running as root should inherit the same capabilities of the user, which > > includes > > CAP_IPC_LOCK. Running Libvirt from source code should grant ipc_lock > > to it ... right? > > > > > > > > Any help is appreciated. I can provide more details (VM XML for example) > > if necessary. > > > > > > Thanks! > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] news: Fix typo
Signed-off-by: Andrea Bolognani --- Pushed as trivial. docs/news.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/news.xml b/docs/news.xml index a443af013b..8d6d58ae6a 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -70,7 +70,7 @@ By default, libvirt runs the QEMU process as qemu:qemu which could cause issues during probing as some features like AMD SEV - might be inaccesible to QEMU because of file system permissions. + might be inaccessible to QEMU because of file system permissions. Therefore, CAP_DAC_OVERRIDE is granted to overcome these for the purposes of probing. -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list