[v2,3/3] conf: Add virDomainVirtType enum error label

Message ID 6426ebc4429aeb2d475e55ab8af8ca69a9197731.1555363506.git.crobinso@redhat.com
State New
Headers show
Series
  • Add 'label' arg to VIR_ENUM_IMPL
Related show

Commit Message

Cole Robinson April 15, 2019, 9:26 p.m.
Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
Not sure if we should apply this now or after some flag day. I'm
open to suggestions

 src/bhyve/bhyve_driver.c     |  6 +-----
 src/conf/domain_conf.c       | 12 +++---------
 src/libxl/libxl_driver.c     |  6 +-----
 src/qemu/qemu_capabilities.c |  5 +----
 4 files changed, 6 insertions(+), 23 deletions(-)

-- 
2.21.0

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

Patch

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 061888ab0b..ccfcee379f 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1589,12 +1589,8 @@  bhyveConnectGetDomainCapabilities(virConnectPtr conn,
         return ret;
 
     if (virttype_str &&
-        (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("unknown virttype: %s"),
-                       virttype_str);
+        (virttype = virDomainVirtTypeFromString(virttype_str)) < 0)
         goto cleanup;
-    }
 
     if (virttype != VIR_DOMAIN_VIRT_BHYVE) {
         virReportError(VIR_ERR_INVALID_ARG,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 60b8feee0c..1fbe8c040b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -104,7 +104,7 @@  VIR_ENUM_IMPL(virDomainTaint, NULL,
               "custom-ga-command",
 );
 
-VIR_ENUM_IMPL(virDomainVirt, NULL,
+VIR_ENUM_IMPL(virDomainVirt, "domain type",
               VIR_DOMAIN_VIRT_LAST,
               "none",
               "qemu",
@@ -19327,11 +19327,8 @@  virDomainDefParseCaps(virDomainDefPtr def,
                        "%s", _("missing domain type attribute"));
         return -1;
     }
-    if ((def->virtType = virDomainVirtTypeFromString(virttype)) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("invalid domain type %s"), virttype);
+    if ((def->virtType = virDomainVirtTypeFromString(virttype)) < 0)
         return -1;
-    }
 
     if (!ostype) {
         if (def->os.bootloader) {
@@ -28035,11 +28032,8 @@  virDomainDefFormatInternal(virDomainDefPtr def,
                   VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST,
                   -1);
 
-    if (!(type = virDomainVirtTypeToString(def->virtType))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("unexpected domain type %d"), def->virtType);
+    if (!(type = virDomainVirtTypeToString(def->virtType)))
         goto error;
-    }
 
     if (def->id == -1)
         flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index a9edc8211d..428ef1f64e 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -6365,12 +6365,8 @@  libxlConnectGetDomainCapabilities(virConnectPtr conn,
     cfg = libxlDriverConfigGet(driver);
 
     if (virttype_str &&
-        (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("unknown virttype: %s"),
-                       virttype_str);
+        (virttype = virDomainVirtTypeFromString(virttype_str)) < 0)
         goto cleanup;
-    }
 
     if (virttype != VIR_DOMAIN_VIRT_XEN) {
         virReportError(VIR_ERR_INVALID_ARG,
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9eb5e418cc..27315efb15 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4800,11 +4800,8 @@  virQEMUCapsCacheLookupDefault(virFileCachePtr cache,
     virQEMUCapsPtr ret = NULL;
 
     if (virttypeStr &&
-        (virttype = virDomainVirtTypeFromString(virttypeStr)) < 0) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("unknown virttype: %s"), virttypeStr);
+        (virttype = virDomainVirtTypeFromString(virttypeStr)) < 0)
         goto cleanup;
-    }
 
     if (archStr &&
         (arch = virArchFromString(archStr)) == VIR_ARCH_NONE) {