[RFC,2/2] conf: Convert virDomainVirtType to VIR_ENUM_IMPL_LABEL

Message ID 8e2e9469e7aa25d03c95c92dec137fafc0b17f51.1532625483.git.crobinso@redhat.com
State New
Headers show
Series
  • util: Add VIR_ENUM_IMPL_LABEL
Related show

Commit Message

Cole Robinson July 26, 2018, 5:49 p.m.
Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/conf/domain_conf.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

-- 
2.17.1

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

Patch

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;