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

[libvirt] [PATCH 06/11] caps: Convert to use VIR_DOMAIN_VIRT internally



---
 src/bhyve/bhyve_capabilities.c   |  4 ++--
 src/conf/capabilities.c          | 28 ++++++++++++++--------------
 src/conf/capabilities.h          | 10 +++++-----
 src/conf/domain_conf.c           | 17 +++++------------
 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 |  8 ++++----
 src/phyp/phyp_driver.c           |  4 ++--
 src/qemu/qemu_capabilities.c     |  8 ++++----
 src/qemu/qemu_command.c          |  2 +-
 src/test/test_driver.c           |  2 +-
 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 ++--
 src/xenconfig/xen_common.c       |  4 ++--
 tests/testutils.c                |  4 ++--
 tests/testutilslxc.c             |  4 ++--
 tests/testutilsqemu.c            | 20 ++++++++++----------
 tests/testutilsxen.c             |  8 ++++----
 tests/vmx2xmltest.c              |  4 ++--
 tests/xml2vmxtest.c              |  4 ++--
 25 files changed, 75 insertions(+), 82 deletions(-)

diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index 3cb6778..e6d5518 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -92,8 +92,8 @@ virBhyveCapsBuild(void)
                                          NULL, 0, NULL)) == NULL)
         goto error;
 
-    if (virCapabilitiesAddGuestDomain(guest,
-                                      "bhyve", NULL, NULL, 0, NULL) == NULL)
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_BHYVE,
+                                      NULL, NULL, 0, NULL) == NULL)
         goto error;
 
     if (virBhyveCapsInitCPU(caps, virArchFromHost()) < 0)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index deae472..9f84766 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -135,7 +135,6 @@ virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom)
     for (i = 0; i < dom->info.nmachines; i++)
         virCapabilitiesFreeGuestMachine(dom->info.machines[i]);
     VIR_FREE(dom->info.machines);
-    VIR_FREE(dom->type);
 
     VIR_FREE(dom);
 }
@@ -459,7 +458,7 @@ virCapabilitiesAddGuest(virCapsPtr caps,
  */
 virCapsGuestDomainPtr
 virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
-                              const char *hvtype,
+                              int hvtype,
                               const char *emulator,
                               const char *loader,
                               int nmachines,
@@ -470,8 +469,8 @@ virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
     if (VIR_ALLOC(dom) < 0)
         goto error;
 
-    if (VIR_STRDUP(dom->type, hvtype) < 0 ||
-        VIR_STRDUP(dom->info.emulator, emulator) < 0 ||
+    dom->type = hvtype;
+    if (VIR_STRDUP(dom->info.emulator, emulator) < 0 ||
         VIR_STRDUP(dom->info.loader, loader) < 0)
         goto error;
 
@@ -641,6 +640,7 @@ virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps,
  * virCapabilitiesDefaultGuestArch:
  * @caps: capabilities to query
  * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
+ * @domain: domain type to search for, of enum VIR_DOMAIN_VIRT
  *
  * Returns the first architecture able to run the
  * requested operating system type
@@ -648,7 +648,7 @@ virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps,
 extern virArch
 virCapabilitiesDefaultGuestArch(virCapsPtr caps,
                                 int ostype,
-                                const char *domain)
+                                int domain)
 {
     size_t i, j;
 
@@ -656,7 +656,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps,
     for (i = 0; i < caps->nguests; i++) {
         if (caps->guests[i]->ostype == ostype) {
             for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
-                if (STREQ(caps->guests[i]->arch.domains[j]->type, domain) &&
+                if (caps->guests[i]->arch.domains[j]->type == domain &&
                     caps->guests[i]->arch.id == caps->host.arch)
                     return caps->guests[i]->arch.id;
             }
@@ -667,7 +667,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps,
     for (i = 0; i < caps->nguests; i++) {
         if (caps->guests[i]->ostype == ostype) {
             for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
-                if (STREQ(caps->guests[i]->arch.domains[j]->type, domain))
+                if (caps->guests[i]->arch.domains[j]->type == domain)
                     return caps->guests[i]->arch.id;
             }
         }
@@ -681,7 +681,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps,
  * @caps: capabilities to query
  * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
  * @arch: architecture to search for
- * @domain: domain type to search for
+ * @domain: domain type to search for, of enum VIR_DOMAIN_VIRT
  *
  * Returns the first machine variant associated with
  * the requested operating system type, architecture
@@ -691,7 +691,7 @@ extern const char *
 virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
                                    int ostype,
                                    virArch arch,
-                                   const char *domain)
+                                   int domain)
 {
     size_t i;
 
@@ -706,7 +706,7 @@ virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
         for (j = 0; j < guest->arch.ndomains; j++) {
             virCapsGuestDomainPtr dom = guest->arch.domains[j];
 
-            if (!STREQ(dom->type, domain))
+            if (dom->type != domain)
                 continue;
 
             if (!dom->info.nmachines)
@@ -727,7 +727,7 @@ virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
  * @caps: capabilities to query
  * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
  * @arch: architecture to search for
- * @domain: domain type ('xen', 'qemu', 'kvm')
+ * @domain: domain type to search for, of enum VIR_DOMAIN_VIRT
  *
  * Returns the first emulator path associated with
  * the requested operating system type, architecture
@@ -737,7 +737,7 @@ extern const char *
 virCapabilitiesDefaultGuestEmulator(virCapsPtr caps,
                                     int ostype,
                                     virArch arch,
-                                    const char *domain)
+                                    int domain)
 {
     size_t i, j;
 
@@ -747,7 +747,7 @@ virCapabilitiesDefaultGuestEmulator(virCapsPtr caps,
             caps->guests[i]->arch.id == arch) {
             emulator = caps->guests[i]->arch.defaultInfo.emulator;
             for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
-                if (STREQ(caps->guests[i]->arch.domains[j]->type, domain)) {
+                if (caps->guests[i]->arch.domains[j]->type == domain) {
                     if (caps->guests[i]->arch.domains[j]->info.emulator)
                         emulator = caps->guests[i]->arch.domains[j]->info.emulator;
                 }
@@ -970,7 +970,7 @@ virCapabilitiesFormatXML(virCapsPtr caps)
 
         for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
             virBufferAsprintf(&buf, "<domain type='%s'",
-                                  caps->guests[i]->arch.domains[j]->type);
+                virDomainVirtTypeToString(caps->guests[i]->arch.domains[j]->type));
             if (!caps->guests[i]->arch.domains[j]->info.emulator &&
                 !caps->guests[i]->arch.domains[j]->info.loader &&
                 !caps->guests[i]->arch.domains[j]->info.nmachines) {
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index 8969a97..7ee834f 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -61,7 +61,7 @@ struct _virCapsGuestDomainInfo {
 typedef struct _virCapsGuestDomain virCapsGuestDomain;
 typedef virCapsGuestDomain *virCapsGuestDomainPtr;
 struct _virCapsGuestDomain {
-    char *type;
+    int type;
     virCapsGuestDomainInfo info;
 };
 
@@ -245,7 +245,7 @@ virCapabilitiesAddGuest(virCapsPtr caps,
 
 extern virCapsGuestDomainPtr
 virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
-                              const char *hvtype,
+                              int hvtype,
                               const char *emulator,
                               const char *loader,
                               int nmachines,
@@ -280,17 +280,17 @@ virCapabilitiesClearHostNUMACellCPUTopology(virCapsHostNUMACellCPUPtr cpu,
 extern virArch
 virCapabilitiesDefaultGuestArch(virCapsPtr caps,
                                 int ostype,
-                                const char *domain);
+                                int domain);
 extern const char *
 virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
                                    int ostype,
                                    virArch arch,
-                                   const char *domain);
+                                   int domain);
 extern const char *
 virCapabilitiesDefaultGuestEmulator(virCapsPtr caps,
                                     int ostype,
                                     virArch arch,
-                                    const char *domain);
+                                    int domain);
 
 extern char *
 virCapabilitiesFormatXML(virCapsPtr caps);
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 727d060..59002fd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12959,27 +12959,20 @@ char *
 virDomainDefGetDefaultEmulator(virDomainDefPtr def,
                                virCapsPtr caps)
 {
-    const char *type;
     const char *emulator;
     char *retemu;
 
-    type = virDomainVirtTypeToString(def->virtType);
-    if (!type) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("unknown virt type"));
-        return NULL;
-    }
-
     emulator = virCapabilitiesDefaultGuestEmulator(caps,
                                                    def->os.type,
                                                    def->os.arch,
-                                                   type);
+                                                   def->virtType);
 
     if (!emulator) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("no emulator for domain %s os type %s "
                          "on architecture %s"),
-                       type, virDomainOSTypeToString(def->os.type),
+                       virDomainVirtTypeToString(def->virtType),
+                       virDomainOSTypeToString(def->os.type),
                        virArchToString(def->os.arch));
         return NULL;
     }
@@ -14696,7 +14689,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             def->os.arch =
                 virCapabilitiesDefaultGuestArch(caps,
                                                 def->os.type,
-                                                virDomainVirtTypeToString(def->virtType));
+                                                def->virtType);
             if (!def->os.arch) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("no supported architecture for os type '%s'"),
@@ -14709,7 +14702,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             const char *defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
                                                                             def->os.type,
                                                                             def->os.arch,
-                                                                            virDomainVirtTypeToString(def->virtType));
+                                                                            def->virtType);
             if (VIR_STRDUP(def->os.machine, defaultMachine) < 0)
                 goto error;
         }
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index c114861..4652b96 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -581,7 +581,7 @@ esxCapsInit(esxPrivate *priv)
     if (!guest)
         goto failure;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0, NULL))
         goto failure;
 
     /* x86_64 */
@@ -594,7 +594,7 @@ esxCapsInit(esxPrivate *priv)
         if (!guest)
             goto failure;
 
-        if (!virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL))
+        if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0, NULL))
             goto failure;
     }
 
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 322dd56..a39c977 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -439,7 +439,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
         machines = NULL;
 
         if (virCapabilitiesAddGuestDomain(guest,
-                                          "xen",
+                                          VIR_DOMAIN_VIRT_XEN,
                                           NULL,
                                           NULL,
                                           0,
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 999e45f..c393cb5 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -108,7 +108,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
         goto error;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "lxc",
+                                      VIR_DOMAIN_VIRT_LXC,
                                       NULL,
                                       NULL,
                                       0,
@@ -127,7 +127,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
             goto error;
 
         if (virCapabilitiesAddGuestDomain(guest,
-                                          "lxc",
+                                          VIR_DOMAIN_VIRT_LXC,
                                           NULL,
                                           NULL,
                                           0,
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index a2d2da7..49d78c6 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -188,7 +188,7 @@ virCapsPtr openvzCapsInit(void)
         goto no_memory;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "openvz",
+                                      VIR_DOMAIN_VIRT_OPENVZ,
                                       NULL,
                                       NULL,
                                       0,
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index f7a75e0..5ea8ba3 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -106,8 +106,8 @@ parallelsBuildCapabilities(void)
         goto error;
 
 
-    if (virCapabilitiesAddGuestDomain(guest,
-                                      "parallels", NULL, NULL, 0, NULL) == NULL)
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_PARALLELS,
+                                      NULL, NULL, 0, NULL) == NULL)
         goto error;
 
     if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
@@ -116,8 +116,8 @@ parallelsBuildCapabilities(void)
                                          NULL, 0, NULL)) == NULL)
         goto error;
 
-    if (virCapabilitiesAddGuestDomain(guest,
-                                      "parallels", NULL, NULL, 0, NULL) == NULL)
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_PARALLELS,
+                                      NULL, NULL, 0, NULL) == NULL)
         goto error;
 
     if (nodeGetInfo(&nodeinfo))
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 6e177b0..007defa 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -347,8 +347,8 @@ phypCapsInit(void)
                                          NULL, NULL, 0, NULL)) == NULL)
         goto no_memory;
 
-    if (virCapabilitiesAddGuestDomain(guest,
-                                      "phyp", NULL, NULL, 0, NULL) == NULL)
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_PHYP,
+                                      NULL, NULL, 0, NULL) == NULL)
         goto no_memory;
 
     return caps;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index afeeddf..ad50360 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -858,7 +858,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
         goto cleanup;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "qemu",
+                                      VIR_DOMAIN_VIRT_QEMU,
                                       NULL,
                                       NULL,
                                       0,
@@ -867,7 +867,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
 
     if (haskqemu &&
         virCapabilitiesAddGuestDomain(guest,
-                                      "kqemu",
+                                      VIR_DOMAIN_VIRT_KQEMU,
                                       NULL,
                                       NULL,
                                       0,
@@ -882,7 +882,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
             goto cleanup;
 
         if ((dom = virCapabilitiesAddGuestDomain(guest,
-                                                 "kvm",
+                                                 VIR_DOMAIN_VIRT_KVM,
                                                  kvmbin ? kvmbin : binary,
                                                  NULL,
                                                  nmachines,
@@ -1899,7 +1899,7 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps,
     if ((binary = virCapabilitiesDefaultGuestEmulator(caps,
                                                       VIR_DOMAIN_OSTYPE_HVM,
                                                       hostarch,
-                                                      "qemu")) == NULL) {
+                                                      VIR_DOMAIN_VIRT_QEMU)) == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Cannot find suitable emulator for %s"),
                        virArchToString(hostarch));
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 886bba4..8e7b689 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -13149,7 +13149,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
                         virCapabilitiesDefaultGuestMachine(qemuCaps,
                                                            def->os.type,
                                                            def->os.arch,
-                                                           virDomainVirtTypeToString(def->virtType));
+                                                           def->virtType);
         if (defaultMachine != NULL)
             if (VIR_STRDUP(def->os.machine, defaultMachine) < 0)
                 goto error;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 0dec75e..44f6adf 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -353,7 +353,7 @@ testBuildCapabilities(virConnectPtr conn)
             goto error;
 
         if (virCapabilitiesAddGuestDomain(guest,
-                                          "test",
+                                          VIR_DOMAIN_VIRT_TEST,
                                           NULL,
                                           NULL,
                                           0,
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index d4d380a..86fbecc 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -89,7 +89,7 @@ virCapsPtr umlCapsInit(void)
         goto error;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "uml",
+                                      VIR_DOMAIN_VIRT_UML,
                                       NULL,
                                       NULL,
                                       0,
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index b419ddc..8424713 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -331,7 +331,7 @@ static virCapsPtr vboxCapsInit(void)
         goto no_memory;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "vbox",
+                                      VIR_DOMAIN_VIRT_VBOX,
                                       NULL,
                                       NULL,
                                       0,
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 6e274e2..5b249f8 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -79,7 +79,7 @@ vmwareCapsInit(void)
         goto error;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "vmware",
+                                      VIR_DOMAIN_VIRT_VMWARE,
                                       NULL, NULL, 0, NULL) == NULL)
         goto error;
 
@@ -111,7 +111,7 @@ vmwareCapsInit(void)
             goto error;
 
         if (virCapabilitiesAddGuestDomain(guest,
-                                          "vmware",
+                                          VIR_DOMAIN_VIRT_VMWARE,
                                           NULL, NULL, 0, NULL) == NULL)
             goto error;
     }
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 82447c1..431c47a 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2158,7 +2158,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn, virArch hostarch,
         machines = NULL;
 
         if (virCapabilitiesAddGuestDomain(guest,
-                                          "xen",
+                                          VIR_DOMAIN_VIRT_XEN,
                                           NULL,
                                           NULL,
                                           0,
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 6b2e5ee..881f5b2 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -109,13 +109,13 @@ getCapsObject(void)
     guest1 = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, "", "", 0, NULL);
     if (!guest1)
         goto error_cleanup;
-    domain1 = virCapabilitiesAddGuestDomain(guest1, "xen", "", "", 0, NULL);
+    domain1 = virCapabilitiesAddGuestDomain(guest1, VIR_DOMAIN_VIRT_XEN, "", "", 0, NULL);
     if (!domain1)
         goto error_cleanup;
     guest2 = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XEN, VIR_ARCH_X86_64, "", "", 0, NULL);
     if (!guest2)
         goto error_cleanup;
-    domain2 = virCapabilitiesAddGuestDomain(guest2, "xen", "", "", 0, NULL);
+    domain2 = virCapabilitiesAddGuestDomain(guest2, VIR_DOMAIN_VIRT_XEN, "", "", 0, NULL);
     if (!domain2)
         goto error_cleanup;
 
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 48484d6..728b910 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1002,7 +1002,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
     def->os.arch =
         virCapabilitiesDefaultGuestArch(caps,
                                         def->os.type,
-                                        virDomainVirtTypeToString(def->virtType));
+                                        def->virtType);
     if (!def->os.arch) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("no supported architecture for os type '%s'"),
@@ -1013,7 +1013,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
     defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
                                                         def->os.type,
                                                         def->os.arch,
-                                                        virDomainVirtTypeToString(def->virtType));
+                                                        def->virtType);
     if (defaultMachine != NULL) {
         if (VIR_STRDUP(def->os.machine, defaultMachine) < 0)
             return -1;
diff --git a/tests/testutils.c b/tests/testutils.c
index 2e18040..aca2fd0 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -940,7 +940,7 @@ virCapsPtr virTestGenericCapsInit(void)
                                          0, NULL)) == NULL)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "test", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, NULL, 0, NULL))
         goto error;
 
 
@@ -949,7 +949,7 @@ virCapsPtr virTestGenericCapsInit(void)
                                          0, NULL)) == NULL)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "test", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, NULL, 0, NULL))
         goto error;
 
 
diff --git a/tests/testutilslxc.c b/tests/testutilslxc.c
index c05e37c..3e4d948 100644
--- a/tests/testutilslxc.c
+++ b/tests/testutilslxc.c
@@ -23,7 +23,7 @@ virCapsPtr testLXCCapsInit(void)
                                          0, NULL)) == NULL)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "lxc", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL))
         goto error;
 
 
@@ -33,7 +33,7 @@ virCapsPtr testLXCCapsInit(void)
                                          0, NULL)) == NULL)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "lxc", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL))
         goto error;
 
 
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 579cbe2..bbf58ee 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -152,7 +152,7 @@ static int testQemuAddPPC64Guest(virCapsPtr caps)
     if (!guest)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
         goto error;
 
     return 0;
@@ -179,7 +179,7 @@ static int testQemuAddPPC64LEGuest(virCapsPtr caps)
     if (!guest)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
         goto error;
 
     return 0;
@@ -209,7 +209,7 @@ static int testQemuAddPPCGuest(virCapsPtr caps)
     if (!guest)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
         goto error;
 
     return 0;
@@ -239,7 +239,7 @@ static int testQemuAddS390Guest(virCapsPtr caps)
     if (!guest)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
         goto error;
 
     return 0;
@@ -269,7 +269,7 @@ static int testQemuAddArmGuest(virCapsPtr caps)
     if (!guest)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
         goto error;
 
     return 0;
@@ -297,7 +297,7 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps)
     if (!guest)
         goto error;
 
-    if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
         goto error;
 
     return 0;
@@ -347,7 +347,7 @@ virCapsPtr testQemuCapsInit(void)
     machines = NULL;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "qemu",
+                                      VIR_DOMAIN_VIRT_QEMU,
                                       NULL,
                                       NULL,
                                       0,
@@ -365,7 +365,7 @@ virCapsPtr testQemuCapsInit(void)
     machines = NULL;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "qemu",
+                                      VIR_DOMAIN_VIRT_QEMU,
                                       NULL,
                                       NULL,
                                       0,
@@ -376,7 +376,7 @@ virCapsPtr testQemuCapsInit(void)
         goto cleanup;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "kvm",
+                                      VIR_DOMAIN_VIRT_KVM,
                                       "/usr/bin/kvm",
                                       NULL,
                                       nmachines,
@@ -395,7 +395,7 @@ virCapsPtr testQemuCapsInit(void)
     machines = NULL;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "kvm",
+                                      VIR_DOMAIN_VIRT_KVM,
                                       "/usr/bin/kvm",
                                       NULL,
                                       0,
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index 44b48d4..122789c 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -37,7 +37,7 @@ virCapsPtr testXenCapsInit(void)
     machines = NULL;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "xen",
+                                      VIR_DOMAIN_VIRT_XEN,
                                       NULL,
                                       NULL,
                                       0,
@@ -55,7 +55,7 @@ virCapsPtr testXenCapsInit(void)
     machines = NULL;
 
     if (virCapabilitiesAddGuestDomain(guest,
-                                      "xen",
+                                      VIR_DOMAIN_VIRT_XEN,
                                       NULL,
                                       NULL,
                                       0,
@@ -98,7 +98,7 @@ testXLInitCaps(void)
                                          nmachines, machines)) == NULL)
         goto cleanup;
     machines = NULL;
-    if (virCapabilitiesAddGuestDomain(guest, "xen", NULL,
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
                                       NULL, 0, NULL) == NULL)
         goto cleanup;
     nmachines = ARRAY_CARDINALITY(xen_machines);
@@ -113,7 +113,7 @@ testXLInitCaps(void)
         goto cleanup;
     machines = NULL;
 
-    if (virCapabilitiesAddGuestDomain(guest, "xen", NULL,
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL,
                                       NULL, 0, NULL) == NULL)
         goto cleanup;
     return caps;
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index caef2f7..69d2b43 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -41,7 +41,7 @@ testCapsInit(void)
     if (guest == NULL)
         goto failure;
 
-    if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0,
                                       NULL) == NULL) {
         goto failure;
     }
@@ -55,7 +55,7 @@ testCapsInit(void)
     if (guest == NULL)
         goto failure;
 
-    if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0,
                                       NULL) == NULL) {
         goto failure;
     }
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 9bc6ae8..19d62d3 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -42,7 +42,7 @@ testCapsInit(void)
     if (guest == NULL)
         goto failure;
 
-    if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0,
                                       NULL) == NULL) {
         goto failure;
     }
@@ -56,7 +56,7 @@ testCapsInit(void)
     if (guest == NULL)
         goto failure;
 
-    if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
+    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0,
                                       NULL) == NULL) {
         goto failure;
     }
-- 
2.3.5


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