[PATCH 04/11] caps: Switch AddGuest to take VIR_DOMAIN_OSTYPE value

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

 



Rather than an opencoded string. This should be a no-op
---
 src/bhyve/bhyve_capabilities.c   |  2 +-
 src/conf/capabilities.c          | 11 ++---------
 src/conf/capabilities.h          |  2 +-
 src/esx/esx_driver.c             |  4 ++--
 src/libxl/libxl_conf.c           |  2 +-
 src/lxc/lxc_conf.c               |  4 ++--
 src/openvz/openvz_conf.c         |  2 +-
 src/parallels/parallels_driver.c |  6 +++---
 src/phyp/phyp_driver.c           |  2 +-
 src/qemu/qemu_capabilities.c     |  2 +-
 src/security/virt-aa-helper.c    |  9 +++++++--
 src/test/test_driver.c           |  3 ++-
 src/uml/uml_conf.c               |  2 +-
 src/vbox/vbox_common.c           |  2 +-
 src/vmware/vmware_conf.c         |  4 ++--
 src/xen/xen_hypervisor.c         |  2 +-
 src/xenapi/xenapi_driver.c       |  4 ++--
 tests/testutils.c                |  4 ++--
 tests/testutilslxc.c             |  6 ++++--
 tests/testutilsqemu.c            | 18 +++++++++---------
 tests/testutilsxen.c             | 10 ++++++----
 tests/vmx2xmltest.c              |  4 ++--
 tests/xml2vmxtest.c              |  4 ++--
 23 files changed, 56 insertions(+), 53 deletions(-)

diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index fff0312..3cb6778 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -86,7 +86,7 @@ virBhyveCapsBuild(void)
                                    false, false)) == NULL)
         return NULL;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm",
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                                          VIR_ARCH_X86_64,
                                          "bhyve",
                                          NULL, 0, NULL)) == NULL)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index acae41a..a8b098a 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -393,7 +393,7 @@ virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
 /**
  * virCapabilitiesAddGuest:
  * @caps: capabilities to extend
- * @ostype: guest operating system type ('hvm' or 'xen')
+ * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
  * @arch: guest CPU architecture
  * @wordsize: number of bits in CPU word
  * @emulator: path to default device emulator for arch/ostype
@@ -407,7 +407,7 @@ virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
  */
 virCapsGuestPtr
 virCapabilitiesAddGuest(virCapsPtr caps,
-                        const char *ostypestr,
+                        int ostype,
                         virArch arch,
                         const char *emulator,
                         const char *loader,
@@ -415,17 +415,10 @@ virCapabilitiesAddGuest(virCapsPtr caps,
                         virCapsGuestMachinePtr *machines)
 {
     virCapsGuestPtr guest;
-    int ostype;
 
     if (VIR_ALLOC(guest) < 0)
         goto error;
 
-    if ((ostype = virDomainOSTypeFromString(ostypestr)) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("unknown OS type '%s'"), ostypestr);
-        goto error;
-    }
-
     guest->ostype = ostype;
     guest->arch.id = arch;
     guest->arch.wordsize = virArchGetWordSize(arch);
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index fc852ac..9312cc2 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -236,7 +236,7 @@ virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
 
 extern virCapsGuestPtr
 virCapabilitiesAddGuest(virCapsPtr caps,
-                        const char *ostype,
+                        int ostype,
                         virArch arch,
                         const char *emulator,
                         const char *loader,
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index bfc8695..c114861 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -573,7 +573,7 @@ esxCapsInit(esxPrivate *priv)
         goto failure;
 
     /* i686 */
-    guest = virCapabilitiesAddGuest(caps, "hvm",
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                                     VIR_ARCH_I686,
                                     NULL, NULL, 0,
                                     NULL);
@@ -586,7 +586,7 @@ esxCapsInit(esxPrivate *priv)
 
     /* x86_64 */
     if (supportsLongMode == esxVI_Boolean_True) {
-        guest = virCapabilitiesAddGuest(caps, "hvm",
+        guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                                         VIR_ARCH_X86_64,
                                         NULL, NULL,
                                         0, NULL);
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 230daec..0609fdd 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -425,7 +425,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
             return -1;
 
         if ((guest = virCapabilitiesAddGuest(caps,
-                                             guest_archs[i].hvm ? "hvm" : "xen",
+                                             guest_archs[i].hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN,
                                              guest_archs[i].arch,
                                              LIBXL_EXECBIN_DIR "/qemu-system-i386",
                                              (guest_archs[i].hvm ?
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index d1a3be5..999e45f 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -99,7 +99,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
         goto error;
 
     if ((guest = virCapabilitiesAddGuest(caps,
-                                         "exe",
+                                         VIR_DOMAIN_OSTYPE_EXE,
                                          caps->host.arch,
                                          lxc_path,
                                          NULL,
@@ -118,7 +118,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
     /* On 64-bit hosts, we can use personality() to request a 32bit process */
     if ((altArch = lxcContainerGetAlt32bitArch(caps->host.arch)) != VIR_ARCH_NONE) {
         if ((guest = virCapabilitiesAddGuest(caps,
-                                             "exe",
+                                             VIR_DOMAIN_OSTYPE_EXE,
                                              altArch,
                                              lxc_path,
                                              NULL,
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index bfa2141..80df15a 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -179,7 +179,7 @@ virCapsPtr openvzCapsInit(void)
         goto no_memory;
 
     if ((guest = virCapabilitiesAddGuest(caps,
-                                         "exe",
+                                         VIR_DOMAIN_OSTYPE_EXE,
                                          caps->host.arch,
                                          NULL,
                                          NULL,
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 3aa87ca..d80fe24 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -93,13 +93,13 @@ parallelsBuildCapabilities(void)
     if (nodeCapsInitNUMA(caps) < 0)
         goto error;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm",
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                                          VIR_ARCH_X86_64,
                                          "parallels",
                                          NULL, 0, NULL)) == NULL)
         goto error;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm",
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                                          VIR_ARCH_I686,
                                          "parallels",
                                          NULL, 0, NULL)) == NULL)
@@ -110,7 +110,7 @@ parallelsBuildCapabilities(void)
                                       "parallels", NULL, NULL, 0, NULL) == NULL)
         goto error;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "exe",
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
                                          VIR_ARCH_X86_64,
                                          "parallels",
                                          NULL, 0, NULL)) == NULL)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index f4db2e0..a6b96de 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -342,7 +342,7 @@ phypCapsInit(void)
     }
 
     if ((guest = virCapabilitiesAddGuest(caps,
-                                         "linux",
+                                         VIR_DOMAIN_OSTYPE_LINUX,
                                          caps->host.arch,
                                          NULL, NULL, 0, NULL)) == NULL)
         goto no_memory;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 3b49271..9606459 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -829,7 +829,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
     /* We register kvm as the base emulator too, since we can
      * just give -no-kvm to disable acceleration if required */
     if ((guest = virCapabilitiesAddGuest(caps,
-                                         "hvm",
+                                         VIR_DOMAIN_OSTYPE_HVM,
                                          guestarch,
                                          binary,
                                          NULL,
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 5a070d7..5a742a5 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -707,7 +707,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
 static int
 get_definition(vahControl * ctl, const char *xmlStr)
 {
-    int rc = -1;
+    int rc = -1, ostype;
     virCapsGuestPtr guest;  /* this is freed when caps is freed */
 
     /*
@@ -727,8 +727,13 @@ get_definition(vahControl * ctl, const char *xmlStr)
         goto exit;
     }
 
+    if ((ostype = virDomainOSTypeFromString(ctl->hvm)) < 0) {
+        vah_error(ctl, _("unknown OS type"));
+        goto exit;
+    }
+
     if ((guest = virCapabilitiesAddGuest(ctl->caps,
-                                         ctl->hvm,
+                                         ostype,
                                          ctl->arch,
                                          NULL,
                                          NULL,
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index d49c4b3..0dec75e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -314,7 +314,8 @@ testBuildCapabilities(virConnectPtr conn)
     testConnPtr privconn = conn->privateData;
     virCapsPtr caps;
     virCapsGuestPtr guest;
-    const char *const guest_types[] = { "hvm", "xen" };
+    int guest_types[] = { VIR_DOMAIN_OSTYPE_HVM,
+                          VIR_DOMAIN_OSTYPE_XEN };
     size_t i;
 
     if ((caps = virCapabilitiesNew(VIR_ARCH_I686, false, false)) == NULL)
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 02f15c6..d4d380a 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -80,7 +80,7 @@ virCapsPtr umlCapsInit(void)
     }
 
     if ((guest = virCapabilitiesAddGuest(caps,
-                                         "uml",
+                                         VIR_DOMAIN_OSTYPE_UML,
                                          caps->host.arch,
                                          NULL,
                                          NULL,
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 78b5906..710c50f 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -322,7 +322,7 @@ static virCapsPtr vboxCapsInit(void)
         goto no_memory;
 
     if ((guest = virCapabilitiesAddGuest(caps,
-                                         "hvm",
+                                         VIR_DOMAIN_OSTYPE_HVM,
                                          caps->host.arch,
                                          NULL,
                                          NULL,
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 5c8a7be..6e274e2 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -73,7 +73,7 @@ vmwareCapsInit(void)
 
     /* i686 guests are always supported */
     if ((guest = virCapabilitiesAddGuest(caps,
-                                         "hvm",
+                                         VIR_DOMAIN_OSTYPE_HVM,
                                          VIR_ARCH_I686,
                                          NULL, NULL, 0, NULL)) == NULL)
         goto error;
@@ -105,7 +105,7 @@ vmwareCapsInit(void)
           cpuHasFeature(data, "svm")))) {
 
         if ((guest = virCapabilitiesAddGuest(caps,
-                                             "hvm",
+                                             VIR_DOMAIN_OSTYPE_HVM,
                                              VIR_ARCH_X86_64,
                                              NULL, NULL, 0, NULL)) == NULL)
             goto error;
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index bc498ff..82447c1 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2142,7 +2142,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn, virArch hostarch,
             goto no_memory;
 
         if ((guest = virCapabilitiesAddGuest(caps,
-                                             guest_archs[i].hvm ? "hvm" : "xen",
+                                             guest_archs[i].hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN,
                                              guest_archs[i].arch,
                                              (hostarch == VIR_ARCH_X86_64 ?
                                               "/usr/lib64/xen/bin/qemu-dm" :
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index d495f21..2ec0b65 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -106,13 +106,13 @@ getCapsObject(void)
 
     if (!caps)
         return NULL;
-    guest1 = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64, "", "", 0, NULL);
+    guest1 = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, "", "", 0, NULL);
     if (!guest1)
         goto error_cleanup;
     domain1 = virCapabilitiesAddGuestDomain(guest1, "xen", "", "", 0, NULL);
     if (!domain1)
         goto error_cleanup;
-    guest2 = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_X86_64, "", "", 0, NULL);
+    guest2 = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XEN, VIR_ARCH_X86_64, "", "", 0, NULL);
     if (!guest2)
         goto error_cleanup;
     domain2 = virCapabilitiesAddGuestDomain(guest2, "xen", "", "", 0, NULL);
diff --git a/tests/testutils.c b/tests/testutils.c
index bebb14b..2e18040 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -935,7 +935,7 @@ virCapsPtr virTestGenericCapsInit(void)
                                    false, false)) == NULL)
         return NULL;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_I686,
                                          "/usr/bin/acme-virt", NULL,
                                          0, NULL)) == NULL)
         goto error;
@@ -944,7 +944,7 @@ virCapsPtr virTestGenericCapsInit(void)
         goto error;
 
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64,
                                          "/usr/bin/acme-virt", NULL,
                                          0, NULL)) == NULL)
         goto error;
diff --git a/tests/testutilslxc.c b/tests/testutilslxc.c
index 09dfd02..c05e37c 100644
--- a/tests/testutilslxc.c
+++ b/tests/testutilslxc.c
@@ -17,7 +17,8 @@ virCapsPtr testLXCCapsInit(void)
                                    false, false)) == NULL)
         return NULL;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_I686,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
+                                         VIR_ARCH_I686,
                                          "/usr/libexec/libvirt_lxc", NULL,
                                          0, NULL)) == NULL)
         goto error;
@@ -26,7 +27,8 @@ virCapsPtr testLXCCapsInit(void)
         goto error;
 
 
-    if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_X86_64,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
+                                         VIR_ARCH_X86_64,
                                          "/usr/libexec/libvirt_lxc", NULL,
                                          0, NULL)) == NULL)
         goto error;
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 7c581a1..579cbe2 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -146,7 +146,7 @@ static int testQemuAddPPC64Guest(virCapsPtr caps)
     if (!machines)
         goto error;
 
-    guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_PPC64,
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64,
                                     "/usr/bin/qemu-system-ppc64", NULL,
                                      1, machines);
     if (!guest)
@@ -173,7 +173,7 @@ static int testQemuAddPPC64LEGuest(virCapsPtr caps)
     if (!machines)
         goto error;
 
-    guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_PPC64LE,
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64LE,
                                     "/usr/bin/qemu-system-ppc64", NULL,
                                      1, machines);
     if (!guest)
@@ -203,7 +203,7 @@ static int testQemuAddPPCGuest(virCapsPtr caps)
     if (!machines)
         goto error;
 
-    guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_PPC,
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC,
                                     "/usr/bin/qemu-system-ppc", NULL,
                                      1, machines);
     if (!guest)
@@ -232,7 +232,7 @@ static int testQemuAddS390Guest(virCapsPtr caps)
     if (!machines)
         goto error;
 
-    guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_S390X,
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_S390X,
                                     "/usr/bin/qemu-system-s390x", NULL,
                                     ARRAY_CARDINALITY(s390_machines),
                                     machines);
@@ -262,7 +262,7 @@ static int testQemuAddArmGuest(virCapsPtr caps)
     if (!capsmachines)
         goto error;
 
-    guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_ARMV7L,
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV7L,
                                     "/usr/bin/qemu-system-arm", NULL,
                                     ARRAY_CARDINALITY(machines),
                                     capsmachines);
@@ -290,7 +290,7 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps)
     if (!capsmachines)
         goto error;
 
-    guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_AARCH64,
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_AARCH64,
                                     "/usr/bin/qemu-system-aarch64", NULL,
                                     ARRAY_CARDINALITY(machines),
                                     capsmachines);
@@ -339,7 +339,7 @@ virCapsPtr testQemuCapsInit(void)
     if ((machines = testQemuAllocMachines(&nmachines)) == NULL)
         goto cleanup;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_I686,
                                          "/usr/bin/qemu", NULL,
                                          nmachines, machines)) == NULL ||
         !virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false))
@@ -357,7 +357,7 @@ virCapsPtr testQemuCapsInit(void)
     if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL)
         goto cleanup;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64,
                                          "/usr/bin/qemu-system-x86_64", NULL,
                                          nmachines, machines)) == NULL ||
         !virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false))
@@ -388,7 +388,7 @@ virCapsPtr testQemuCapsInit(void)
     if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
         goto cleanup;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_X86_64,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XEN, VIR_ARCH_X86_64,
                                          "/usr/bin/xenner", NULL,
                                          nmachines, machines)) == NULL)
         goto cleanup;
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index c60e324..44b48d4 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -30,7 +30,7 @@ virCapsPtr testXenCapsInit(void)
     if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
         goto cleanup;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_I686,
                                          "/usr/lib/xen/bin/qemu-dm", NULL,
                                          nmachines, machines)) == NULL)
         goto cleanup;
@@ -48,7 +48,7 @@ virCapsPtr testXenCapsInit(void)
     if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
         goto cleanup;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_I686,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XEN, VIR_ARCH_I686,
                                          "/usr/lib/xen/bin/qemu-dm", NULL,
                                          nmachines, machines)) == NULL)
         goto cleanup;
@@ -91,7 +91,8 @@ testXLInitCaps(void)
     nmachines = ARRAY_CARDINALITY(x86_machines);
     if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
         goto cleanup;
-    if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
+                                         VIR_ARCH_X86_64,
                                          "/usr/lib/xen/bin/qemu-system-i386",
                                          "/usr/lib/xen/boot/hvmloader",
                                          nmachines, machines)) == NULL)
@@ -104,7 +105,8 @@ testXLInitCaps(void)
     if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
         goto cleanup;
 
-    if ((guest = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_X86_64,
+    if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XEN,
+                                         VIR_ARCH_X86_64,
                                          "/usr/lib/xen/bin/qemu-system-i386",
                                          NULL,
                                          nmachines, machines)) == NULL)
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 412be88..caef2f7 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -34,7 +34,7 @@ testCapsInit(void)
 
     /* i686 guest */
     guest =
-      virCapabilitiesAddGuest(caps, "hvm",
+      virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                               VIR_ARCH_I686,
                               NULL, NULL, 0, NULL);
 
@@ -48,7 +48,7 @@ testCapsInit(void)
 
     /* x86_64 guest */
     guest =
-      virCapabilitiesAddGuest(caps, "hvm",
+      virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                               VIR_ARCH_X86_64,
                               NULL, NULL, 0, NULL);
 
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 2d72407..9bc6ae8 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -35,7 +35,7 @@ testCapsInit(void)
 
     /* i686 guest */
     guest =
-      virCapabilitiesAddGuest(caps, "hvm",
+      virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                               VIR_ARCH_I686,
                               NULL, NULL, 0, NULL);
 
@@ -49,7 +49,7 @@ testCapsInit(void)
 
     /* x86_64 guest */
     guest =
-      virCapabilitiesAddGuest(caps, "hvm",
+      virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
                               VIR_ARCH_X86_64,
                               NULL, NULL, 0, NULL);
 
-- 
2.3.5

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




[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]