From: Joao Martins <[email protected]>

nestedhvm is the option on Xen 4.4+ which enables nested
virtualization on Xen. We set this field when one of the
following features is included in a host-passthrough CPU
element:

<feature policy='require' name='vmx'/>

or:

<feature policy='require' name='svm'/>

Signed-off-by: Joao Martins <[email protected]>
Signed-off-by: Wim ten Have <[email protected]>
---
 src/libxl/libxl_conf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f5b788b..8c4c511 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -374,6 +374,15 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
                           def->features[VIR_DOMAIN_FEATURE_ACPI] ==
                           VIR_TRISTATE_SWITCH_ON);
 
+        if (def->cpu && def->cpu->nfeatures) {
+            for (i = 0; i < def->cpu->nfeatures; i++) {
+                if (def->cpu->features[i].policy == VIR_CPU_FEATURE_REQUIRE &&
+                    (STREQ(def->cpu->features[i].name, "vmx") ||
+                     STREQ(def->cpu->features[i].name, "svm")))
+                    libxl_defbool_set(&b_info->u.hvm.nested_hvm, true);
+            }
+        }
+
         if (def->nsounds > 0) {
             /*
              * Use first sound device.  man xl.cfg(5) describes soundhw as
-- 
2.9.3

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to