render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9c6c51
From eaa86279ad7a2a0e341b5270060f250e24d47af4 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <eaa86279ad7a2a0e341b5270060f250e24d47af4@dist-git>
9c6c51
From: Andrea Bolognani <abologna@redhat.com>
9c6c51
Date: Tue, 4 Dec 2018 16:46:20 +0100
9c6c51
Subject: [PATCH] qemu: Format nested-hv feature on the command line
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
9c6c51
(cherry picked from commit c54d3d00ae1f9cd3f983d8e8c1def551d6ddf9b7)
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1647822
9c6c51
9c6c51
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
9c6c51
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_command.c                      | 20 ++++++++++++++++++++
9c6c51
 tests/qemuxml2argvdata/pseries-features.args |  2 +-
9c6c51
 2 files changed, 21 insertions(+), 1 deletion(-)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
9c6c51
index 320ecd902c..c706a4b095 100644
9c6c51
--- a/src/qemu/qemu_command.c
9c6c51
+++ b/src/qemu/qemu_command.c
9c6c51
@@ -7399,6 +7399,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
9c6c51
         virBufferAsprintf(&buf, ",cap-htm=%s", str);
9c6c51
     }
9c6c51
 
9c6c51
+    if (def->features[VIR_DOMAIN_FEATURE_NESTED_HV] != VIR_TRISTATE_SWITCH_ABSENT) {
9c6c51
+        const char *str;
9c6c51
+
9c6c51
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV)) {
9c6c51
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9c6c51
+                           _("Nested HV configuration is not supported by "
9c6c51
+                             "this QEMU binary"));
9c6c51
+            goto cleanup;
9c6c51
+        }
9c6c51
+
9c6c51
+        str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_NESTED_HV]);
9c6c51
+        if (!str) {
9c6c51
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9c6c51
+                           _("Invalid setting for nested HV state"));
9c6c51
+            goto cleanup;
9c6c51
+        }
9c6c51
+
9c6c51
+        virBufferAsprintf(&buf, ",cap-nested-hv=%s", str);
9c6c51
+    }
9c6c51
+
9c6c51
     if (cpu && cpu->model &&
9c6c51
         cpu->mode == VIR_CPU_MODE_HOST_MODEL &&
9c6c51
         qemuDomainIsPSeries(def) &&
9c6c51
diff --git a/tests/qemuxml2argvdata/pseries-features.args b/tests/qemuxml2argvdata/pseries-features.args
9c6c51
index 226d43df44..2b0a2aa93b 100644
9c6c51
--- a/tests/qemuxml2argvdata/pseries-features.args
9c6c51
+++ b/tests/qemuxml2argvdata/pseries-features.args
9c6c51
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
9c6c51
 -name guest \
9c6c51
 -S \
9c6c51
 -machine pseries,accel=tcg,usb=off,dump-guest-core=off,resize-hpt=required,\
9c6c51
-cap-hpt-max-page-size=1048576k,cap-htm=on \
9c6c51
+cap-hpt-max-page-size=1048576k,cap-htm=on,cap-nested-hv=off \
9c6c51
 -m 512 \
9c6c51
 -smp 1,sockets=1,cores=1,threads=1 \
9c6c51
 -uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
9c6c51
-- 
9c6c51
2.20.1
9c6c51