]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Format nested-hv feature on the command line
authorAndrea Bolognani <abologna@redhat.com>
Tue, 20 Nov 2018 16:23:09 +0000 (17:23 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 27 Nov 2018 16:12:21 +0000 (17:12 +0100)
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/pseries-features.args

index 23a6661c10d22e09fc626beb4cdaf556a36253a8..315419c71b31acb2a765edaac5e128e3ed8efaa7 100644 (file)
@@ -7468,6 +7468,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
         virBufferAsprintf(&buf, ",cap-htm=%s", str);
     }
 
+    if (def->features[VIR_DOMAIN_FEATURE_NESTED_HV] != VIR_TRISTATE_SWITCH_ABSENT) {
+        const char *str;
+
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Nested HV configuration is not supported by "
+                             "this QEMU binary"));
+            goto cleanup;
+        }
+
+        str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_NESTED_HV]);
+        if (!str) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Invalid setting for nested HV state"));
+            goto cleanup;
+        }
+
+        virBufferAsprintf(&buf, ",cap-nested-hv=%s", str);
+    }
+
     if (cpu && cpu->model &&
         cpu->mode == VIR_CPU_MODE_HOST_MODEL &&
         qemuDomainIsPSeries(def) &&
index 5d4b5ce930219f099f4dc11d480c17070e9d81b5..0acab91c2ad5b10548e94429b162fe75e1f488e9 100644 (file)
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
 -name guest \
 -S \
 -machine pseries,accel=tcg,usb=off,dump-guest-core=off,resize-hpt=required,\
-cap-hpt-max-page-size=1048576k,cap-htm=on \
+cap-hpt-max-page-size=1048576k,cap-htm=on,cap-nested-hv=off \
 -m 512 \
 -smp 1,sockets=1,cores=1,threads=1 \
 -uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \