[libvirt] [PATCH 05/10] libxl: prefer new location of nested_hvm in libxl_domain_build_info

Marek Marczykowski-Górecki posted 10 patches 6 years, 11 months ago
There is a newer version of this series
[libvirt] [PATCH 05/10] libxl: prefer new location of nested_hvm in libxl_domain_build_info
Posted by Marek Marczykowski-Górecki 6 years, 11 months ago
If available, use b_info->nested_hvm instead of
b_info->u.hvm.nested_hvm. This will make nested HVM config available
also for PVH domains.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 src/libxl/libxl_conf.c                           | 13 ++++++++++++-
 tests/libxlxml2domconfigdata/fullvirt-cpuid.json |  2 +-
 tests/libxlxml2domconfigdata/vnuma-hvm.json      |  2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 476bcbe..e2bfa2f 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -455,7 +455,18 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
                     }
                 }
             }
-            libxl_defbool_set(&b_info->u.hvm.nested_hvm, hasHwVirt);
+#ifdef LIBXL_HAVE_BUILDINFO_NESTED_HVM
+            libxl_defbool_set(&b_info->nested_hvm, hasHwVirt);
+#else
+            if (hvm) {
+                libxl_defbool_set(&b_info->u.hvm.nested_hvm, hasHwVirt);
+            } else {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        _("unsupported nested HVM setting for %s machine on this Xen version"),
+                        def->os.machine);
+                return -1;
+            }
+#endif
         }
 
         if (def->cpu && def->cpu->mode == VIR_CPU_MODE_CUSTOM) {
diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
index cdc8b98..d46b464 100644
--- a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
+++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
@@ -21,11 +21,11 @@
         ],
         "sched_params": {
         },
+        "nested_hvm": "False",
         "type.hvm": {
             "pae": "True",
             "apic": "True",
             "acpi": "True",
-            "nested_hvm": "False",
             "nographic": "True",
             "vnc": {
                 "enable": "False"
diff --git a/tests/libxlxml2domconfigdata/vnuma-hvm.json b/tests/libxlxml2domconfigdata/vnuma-hvm.json
index 3b2fc5f..02c10a9 100644
--- a/tests/libxlxml2domconfigdata/vnuma-hvm.json
+++ b/tests/libxlxml2domconfigdata/vnuma-hvm.json
@@ -109,11 +109,11 @@
         "sched_params": {
 
         },
+        "nested_hvm": "True",
         "type.hvm": {
             "pae": "True",
             "apic": "True",
             "acpi": "True",
-            "nested_hvm": "True",
             "vga": {
                 "kind": "cirrus"
             },
-- 
git-series 0.9.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/10] libxl: prefer new location of nested_hvm in libxl_domain_build_info
Posted by Jim Fehlig 6 years, 9 months ago
On 08/05/2018 03:48 PM, Marek Marczykowski-Górecki wrote:
> If available, use b_info->nested_hvm instead of
> b_info->u.hvm.nested_hvm. This will make nested HVM config available
> also for PVH domains.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
>   src/libxl/libxl_conf.c                           | 13 ++++++++++++-
>   tests/libxlxml2domconfigdata/fullvirt-cpuid.json |  2 +-
>   tests/libxlxml2domconfigdata/vnuma-hvm.json      |  2 +-
>   3 files changed, 14 insertions(+), 3 deletions(-)

Reviewed-by: Jim Fehlig <jfehlig@suse.com>

Regards,
Jim

> 
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 476bcbe..e2bfa2f 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -455,7 +455,18 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
>                       }
>                   }
>               }
> -            libxl_defbool_set(&b_info->u.hvm.nested_hvm, hasHwVirt);
> +#ifdef LIBXL_HAVE_BUILDINFO_NESTED_HVM
> +            libxl_defbool_set(&b_info->nested_hvm, hasHwVirt);
> +#else
> +            if (hvm) {
> +                libxl_defbool_set(&b_info->u.hvm.nested_hvm, hasHwVirt);
> +            } else {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                        _("unsupported nested HVM setting for %s machine on this Xen version"),
> +                        def->os.machine);
> +                return -1;
> +            }
> +#endif
>           }
>   
>           if (def->cpu && def->cpu->mode == VIR_CPU_MODE_CUSTOM) {
> diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> index cdc8b98..d46b464 100644
> --- a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> @@ -21,11 +21,11 @@
>           ],
>           "sched_params": {
>           },
> +        "nested_hvm": "False",
>           "type.hvm": {
>               "pae": "True",
>               "apic": "True",
>               "acpi": "True",
> -            "nested_hvm": "False",
>               "nographic": "True",
>               "vnc": {
>                   "enable": "False"
> diff --git a/tests/libxlxml2domconfigdata/vnuma-hvm.json b/tests/libxlxml2domconfigdata/vnuma-hvm.json
> index 3b2fc5f..02c10a9 100644
> --- a/tests/libxlxml2domconfigdata/vnuma-hvm.json
> +++ b/tests/libxlxml2domconfigdata/vnuma-hvm.json
> @@ -109,11 +109,11 @@
>           "sched_params": {
>   
>           },
> +        "nested_hvm": "True",
>           "type.hvm": {
>               "pae": "True",
>               "apic": "True",
>               "acpi": "True",
> -            "nested_hvm": "True",
>               "vga": {
>                   "kind": "cirrus"
>               },
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list