In the QEMU tests a test can either use an explicitly listed set of
capabilities, or can request those matching a particular QEMU
version. Sometimes it is desirable to be able to list extra caps
on top of those implied by a particular version.
This is useful, for example, when QEMU won't report certain features
unless it was run on particular hardware or kernels, and those were
not used when a caps snapshot was imported to the libvirt source tree.
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
bool stripmachinealiases = false;
virQEMUCaps *cachedcaps = NULL;
- if (info->args.fakeCapsUsed) {
- fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH or ARG_CAPS_VER\n");
- return -1;
- }
-
info->arch = virArchFromString(info->args.capsarch);
if (STREQ(info->args.capsver, "latest")) {
if (!(info->qemuCaps = virQEMUCapsNewCopy(cachedcaps)))
return -1;
+ if (info->args.fakeCapsUsed) {
+ size_t i;
+ for (i = 0; i < QEMU_CAPS_LAST; i++) {
+ if (virQEMUCapsGet(info->args.fakeCaps, i)) {
+ virQEMUCapsSet(info->qemuCaps, i);
+ }
+ }
+ }
+
+
if (stripmachinealiases)
virQEMUCapsStripMachineAliases(info->qemuCaps);