[libvirt] [PATCH RFC 2/2] conf: Convert virDomainVirtType to VIR_ENUM_IMPL_LABEL

Cole Robinson crobinso at redhat.com
Thu Jul 26 17:49:55 UTC 2018


Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/conf/domain_conf.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f94a90fbcc..eb40b7f349 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -103,7 +103,7 @@ VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
               "custom-dtb",
               "custom-ga-command");
 
-VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
+VIR_ENUM_IMPL_LABEL(virDomainVirt, "domain type", VIR_DOMAIN_VIRT_LAST,
               "none",
               "qemu",
               "kqemu",
@@ -19141,10 +19141,7 @@ virDomainDefParseCaps(virDomainDefPtr def,
         goto cleanup;
     }
     if ((def->virtType = virDomainVirtTypeFromString(virttype)) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("invalid domain type %s"), virttype);
         goto cleanup;
-    }
 
     if (!ostype) {
         if (def->os.bootloader) {
@@ -27380,11 +27377,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;
-- 
2.17.1




More information about the libvir-list mailing list