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

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

 



Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
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(-)

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) {
-- 
2.21.0

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

  Powered by Linux