[libvirt] [PATCH v4 6/8] tests: check CPU features handling in libxl driver

Marek Marczykowski-Górecki posted 8 patches 7 years, 3 months ago
There is a newer version of this series
[libvirt] [PATCH v4 6/8] tests: check CPU features handling in libxl driver
Posted by Marek Marczykowski-Górecki 7 years, 3 months ago
Test enabling/disabling individual CPU features and also setting
nested HVM support, which is also controlled by CPU features node.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
Changes since v3:
 - adjust for modified nested HVM handling
Changes since v1:
 - rewritten to Jim's test suite for libxl_domain_config generator
---
 tests/libxlxml2domconfigdata/fullvirt-cpuid.json | 64 +++++++++++++++++-
 tests/libxlxml2domconfigdata/fullvirt-cpuid.xml  | 37 ++++++++++-
 tests/libxlxml2domconfigtest.c                   |  1 +-
 3 files changed, 102 insertions(+)
 create mode 100644 tests/libxlxml2domconfigdata/fullvirt-cpuid.json
 create mode 100644 tests/libxlxml2domconfigdata/fullvirt-cpuid.xml

diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
new file mode 100644
index 0000000..28037be
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
@@ -0,0 +1,64 @@
+{
+    "c_info": {
+        "type": "hvm",
+        "name": "XenGuest2",
+        "uuid": "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+    },
+    "b_info": {
+        "max_vcpus": 1,
+        "avail_vcpus": [
+            0
+        ],
+        "max_memkb": 592896,
+        "target_memkb": 403456,
+        "video_memkb": 8192,
+        "shadow_memkb": 5656,
+        "cpuid": [
+            {
+                "leaf": 1,
+                "ecx": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0",
+                "edx": "xxxxxxxxxxxxxxxxxxxxxxxxxxx1xxxx"
+            }
+        ],
+        "sched_params": {
+            "weight": 1000
+        },
+        "type.hvm": {
+            "pae": "True",
+            "apic": "True",
+            "acpi": "True",
+            "vga": {
+
+            },
+            "nested_hvm": "False",
+            "vnc": {
+                "enable": "False"
+            },
+            "sdl": {
+                "enable": "False"
+            },
+            "spice": {
+
+            },
+            "boot": "c",
+            "rdm": {
+
+            }
+        },
+        "arch_arm": {
+
+        }
+    },
+    "disks": [
+        {
+            "pdev_path": "/dev/HostVG/XenGuest2",
+            "vdev": "hda",
+            "backend": "phy",
+            "format": "raw",
+            "removable": 1,
+            "readwrite": 1
+        }
+    ],
+    "on_reboot": "restart",
+    "on_crash": "restart"
+}
diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml b/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml
new file mode 100644
index 0000000..e9eba2e
--- /dev/null
+++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml
@@ -0,0 +1,37 @@
+<domain type='xen'>
+  <name>XenGuest2</name>
+  <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>592896</memory>
+  <currentMemory unit='KiB'>403456</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='xenfv'>hvm</type>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <cpu mode='host-passthrough'>
+    <feature policy='forbid' name='pni'/>
+    <feature policy='forbid' name='vmx'/>
+    <feature policy='require' name='tsc'/>
+  </cpu>
+  <clock offset='variable' adjustment='0' basis='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <disk type='block' device='disk'>
+      <driver name='phy' type='raw'/>
+      <source dev='/dev/HostVG/XenGuest2'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <video>
+      <model type='cirrus' vram='8192' heads='1' primary='yes'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index f2af286..fbac010 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -200,6 +200,7 @@ mymain(void)
     DO_TEST("moredevs-hvm");
     DO_TEST("vnuma-hvm");
     DO_TEST("multiple-ip");
+    DO_TEST("fullvirt-cpuid");
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
git-series 0.9.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 6/8] tests: check CPU features handling in libxl driver
Posted by Jim Fehlig 7 years, 2 months ago
On 02/08/2018 03:58 PM, Marek Marczykowski-Górecki wrote:
> Test enabling/disabling individual CPU features and also setting
> nested HVM support, which is also controlled by CPU features node.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> Changes since v3:
>   - adjust for modified nested HVM handling
> Changes since v1:
>   - rewritten to Jim's test suite for libxl_domain_config generator
> ---
>   tests/libxlxml2domconfigdata/fullvirt-cpuid.json | 64 +++++++++++++++++-
>   tests/libxlxml2domconfigdata/fullvirt-cpuid.xml  | 37 ++++++++++-
>   tests/libxlxml2domconfigtest.c                   |  1 +-
>   3 files changed, 102 insertions(+)
>   create mode 100644 tests/libxlxml2domconfigdata/fullvirt-cpuid.json
>   create mode 100644 tests/libxlxml2domconfigdata/fullvirt-cpuid.xml

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

Regards,
Jim

> 
> diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> new file mode 100644
> index 0000000..28037be
> --- /dev/null
> +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
> @@ -0,0 +1,64 @@
> +{
> +    "c_info": {
> +        "type": "hvm",
> +        "name": "XenGuest2",
> +        "uuid": "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
> +    },
> +    "b_info": {
> +        "max_vcpus": 1,
> +        "avail_vcpus": [
> +            0
> +        ],
> +        "max_memkb": 592896,
> +        "target_memkb": 403456,
> +        "video_memkb": 8192,
> +        "shadow_memkb": 5656,
> +        "cpuid": [
> +            {
> +                "leaf": 1,
> +                "ecx": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0",
> +                "edx": "xxxxxxxxxxxxxxxxxxxxxxxxxxx1xxxx"
> +            }
> +        ],
> +        "sched_params": {
> +            "weight": 1000
> +        },
> +        "type.hvm": {
> +            "pae": "True",
> +            "apic": "True",
> +            "acpi": "True",
> +            "vga": {
> +
> +            },
> +            "nested_hvm": "False",
> +            "vnc": {
> +                "enable": "False"
> +            },
> +            "sdl": {
> +                "enable": "False"
> +            },
> +            "spice": {
> +
> +            },
> +            "boot": "c",
> +            "rdm": {
> +
> +            }
> +        },
> +        "arch_arm": {
> +
> +        }
> +    },
> +    "disks": [
> +        {
> +            "pdev_path": "/dev/HostVG/XenGuest2",
> +            "vdev": "hda",
> +            "backend": "phy",
> +            "format": "raw",
> +            "removable": 1,
> +            "readwrite": 1
> +        }
> +    ],
> +    "on_reboot": "restart",
> +    "on_crash": "restart"
> +}
> diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml b/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml
> new file mode 100644
> index 0000000..e9eba2e
> --- /dev/null
> +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml
> @@ -0,0 +1,37 @@
> +<domain type='xen'>
> +  <name>XenGuest2</name>
> +  <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
> +  <memory unit='KiB'>592896</memory>
> +  <currentMemory unit='KiB'>403456</currentMemory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='xenfv'>hvm</type>
> +  </os>
> +  <features>
> +    <acpi/>
> +    <apic/>
> +    <pae/>
> +  </features>
> +  <cpu mode='host-passthrough'>
> +    <feature policy='forbid' name='pni'/>
> +    <feature policy='forbid' name='vmx'/>
> +    <feature policy='require' name='tsc'/>
> +  </cpu>
> +  <clock offset='variable' adjustment='0' basis='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>restart</on_crash>
> +  <devices>
> +    <disk type='block' device='disk'>
> +      <driver name='phy' type='raw'/>
> +      <source dev='/dev/HostVG/XenGuest2'/>
> +      <target dev='hda' bus='ide'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <input type='mouse' bus='ps2'/>
> +    <input type='keyboard' bus='ps2'/>
> +    <video>
> +      <model type='cirrus' vram='8192' heads='1' primary='yes'/>
> +    </video>
> +  </devices>
> +</domain>
> diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
> index f2af286..fbac010 100644
> --- a/tests/libxlxml2domconfigtest.c
> +++ b/tests/libxlxml2domconfigtest.c
> @@ -200,6 +200,7 @@ mymain(void)
>       DO_TEST("moredevs-hvm");
>       DO_TEST("vnuma-hvm");
>       DO_TEST("multiple-ip");
> +    DO_TEST("fullvirt-cpuid");
>   
>       return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
>   }
> 

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