[libvirt PATCH 11/17] tests: Add HVF support to testutilsqemu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 tests/testutilsqemu.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 7fdb82daec..a75995c77a 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -106,6 +106,18 @@ static const char *const *kvm_machines[VIR_ARCH_LAST] = {
     [VIR_ARCH_S390X] = s390x_machines,
 };
 
+static const char *const *hvf_machines[VIR_ARCH_LAST] = {
+    [VIR_ARCH_I686] = NULL,
+    [VIR_ARCH_X86_64] = x86_64_machines,
+    [VIR_ARCH_AARCH64] = aarch64_machines,
+    [VIR_ARCH_ARMV7L] = NULL,
+    [VIR_ARCH_PPC64] = NULL,
+    [VIR_ARCH_PPC] = NULL,
+    [VIR_ARCH_RISCV32] = NULL,
+    [VIR_ARCH_RISCV64] = NULL,
+    [VIR_ARCH_S390X] = NULL,
+};
+
 static const char *qemu_default_ram_id[VIR_ARCH_LAST] = {
     [VIR_ARCH_I686] = "pc.ram",
     [VIR_ARCH_X86_64] = "pc.ram",
@@ -214,6 +226,18 @@ testQemuAddGuest(virCaps *caps,
                                       NULL, nmachines, machines);
     }
 
+    if (hvf_machines[emu_arch] != NULL) {
+        nmachines = g_strv_length((char **)hvf_machines[emu_arch]);
+        machines = virCapabilitiesAllocMachines(hvf_machines[emu_arch],
+                                                nmachines);
+        if (machines == NULL)
+            goto error;
+
+        virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_HVF,
+                                      qemu_emulators[emu_arch],
+                                      NULL, nmachines, machines);
+    }
+
     return 0;
 
  error:
@@ -403,6 +427,22 @@ int qemuTestCapsCacheInsert(virFileCache *cache,
                     virQEMUCapsSet(tmpCaps, QEMU_CAPS_KVM);
                 }
             }
+            if (hvf_machines[i] != NULL) {
+                for (j = 0; hvf_machines[i][j] != NULL; j++) {
+                    virQEMUCapsAddMachine(tmpCaps,
+                                          VIR_DOMAIN_VIRT_HVF,
+                                          hvf_machines[i][j],
+                                          NULL,
+                                          NULL,
+                                          0,
+                                          false,
+                                          false,
+                                          true,
+                                          defaultRAMid,
+                                          false);
+                    virQEMUCapsSet(tmpCaps, QEMU_CAPS_HVF);
+                }
+            }
         }
 
         if (virFileCacheInsertData(cache, qemu_emulators[i], tmpCaps) < 0) {
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux