[PATCH 2/2] Introduce virDomainOnOff enum

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

 



Replace
virDomainFeatureState
virDomainIoEventFd
virDomainVirtioEventIdx
virDomainDiskCopyOnRead
virDomainMemDump
virDomainPCIRombarMode
virDomainGraphicsSpicePlaybackCompression
---
 src/conf/domain_conf.c   | 140 ++++++++++++++++++-----------------------------
 src/conf/domain_conf.h   |  82 +++++----------------------
 src/libvirt_private.syms |  18 ++----
 src/libxl/libxl_conf.c   |   6 +-
 src/lxc/lxc_container.c  |   4 +-
 src/lxc/lxc_native.c     |   2 +-
 src/qemu/qemu_command.c  |  58 ++++++++++----------
 src/qemu/qemu_process.c  |   2 +-
 src/vbox/vbox_tmpl.c     |  22 ++++----
 src/xenxs/xen_sxpr.c     |  20 +++----
 src/xenxs/xen_xm.c       |  20 +++----
 11 files changed, 139 insertions(+), 235 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 113bd10..438b533 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -149,7 +149,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
               "hyperv",
               "pvspinlock")
 
-VIR_ENUM_IMPL(virDomainFeatureState, VIR_DOMAIN_FEATURE_STATE_LAST,
+VIR_ENUM_IMPL(virDomainOnOff, VIR_DOMAIN_ON_OFF_LAST,
               "default",
               "on",
               "off")
@@ -262,21 +262,6 @@ VIR_ENUM_IMPL(virDomainDeviceSGIO, VIR_DOMAIN_DEVICE_SGIO_LAST,
               "filtered",
               "unfiltered")
 
-VIR_ENUM_IMPL(virDomainIoEventFd, VIR_DOMAIN_IO_EVENT_FD_LAST,
-              "default",
-              "on",
-              "off")
-
-VIR_ENUM_IMPL(virDomainVirtioEventIdx, VIR_DOMAIN_VIRTIO_EVENT_IDX_LAST,
-              "default",
-              "on",
-              "off")
-
-VIR_ENUM_IMPL(virDomainDiskCopyOnRead, VIR_DOMAIN_DISK_COPY_ON_READ_LAST,
-              "default",
-              "on",
-              "off")
-
 VIR_ENUM_IMPL(virDomainController, VIR_DOMAIN_CONTROLLER_TYPE_LAST,
               "ide",
               "fdc",
@@ -439,11 +424,6 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST,
               "ich6",
               "ich9")
 
-VIR_ENUM_IMPL(virDomainMemDump, VIR_DOMAIN_MEM_DUMP_LAST,
-              "default",
-              "on",
-              "off")
-
 VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST,
               "virtio",
               "xen",
@@ -552,12 +532,6 @@ VIR_ENUM_IMPL(virDomainGraphicsSpiceZlibCompression,
               "never",
               "always");
 
-VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
-              VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST,
-              "default",
-              "on",
-              "off");
-
 VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
               VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
               "default",
@@ -592,12 +566,6 @@ VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
               "misc",
               "net")
 
-VIR_ENUM_IMPL(virDomainPCIRombarMode,
-              VIR_DOMAIN_PCI_ROMBAR_LAST,
-              "default",
-              "on",
-              "off")
-
 VIR_ENUM_IMPL(virDomainHub, VIR_DOMAIN_HUB_TYPE_LAST,
               "usb")
 
@@ -2542,7 +2510,7 @@ virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags)
         return true;
     if (info->mastertype != VIR_DOMAIN_CONTROLLER_MASTER_NONE)
         return true;
-    if ((info->rombar != VIR_DOMAIN_PCI_ROMBAR_DEFAULT) ||
+    if ((info->rombar != VIR_DOMAIN_ON_OFF_DEFAULT) ||
         info->romfile)
         return true;
     if (info->bootIndex)
@@ -3149,7 +3117,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
         virBufferAddLit(buf, "<rom");
         if (info->rombar) {
 
-            const char *rombar = virDomainPCIRombarModeTypeToString(info->rombar);
+            const char *rombar = virDomainOnOffTypeToString(info->rombar);
 
             if (!rombar) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -3666,7 +3634,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
     if (rom) {
         char *rombar = virXMLPropString(rom, "bar");
         if (rombar &&
-            ((info->rombar = virDomainPCIRombarModeTypeFromString(rombar)) <= 0)) {
+            ((info->rombar = virDomainOnOffTypeFromString(rombar)) <= 0)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown rom bar value '%s'"), rombar);
             VIR_FREE(rombar);
@@ -5733,7 +5701,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     }
 
     if (removable) {
-        if ((def->removable = virDomainFeatureStateTypeFromString(removable)) < 0) {
+        if ((def->removable = virDomainOnOffTypeFromString(removable)) < 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown disk removable status '%s'"), removable);
             goto error;
@@ -5746,7 +5714,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         }
     } else {
         if (def->bus == VIR_DOMAIN_DISK_BUS_USB) {
-            def->removable = VIR_DOMAIN_FEATURE_STATE_DEFAULT;
+            def->removable = VIR_DOMAIN_ON_OFF_DEFAULT;
         }
     }
 
@@ -5806,7 +5774,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
             goto error;
         }
 
-        if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
+        if ((val = virDomainOnOffTypeFromString(ioeventfd)) <= 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown disk ioeventfd mode '%s'"),
                            ioeventfd);
@@ -5824,7 +5792,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         }
 
         int idx;
-        if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
+        if ((idx = virDomainOnOffTypeFromString(event_idx)) <= 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown disk event_idx mode '%s'"),
                            event_idx);
@@ -5835,7 +5803,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 
     if (copy_on_read) {
         int cor;
-        if ((cor = virDomainDiskCopyOnReadTypeFromString(copy_on_read)) <= 0) {
+        if ((cor = virDomainOnOffTypeFromString(copy_on_read)) <= 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown disk copy_on_read mode '%s'"),
                            copy_on_read);
@@ -6977,7 +6945,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         }
         if (ioeventfd) {
             int val;
-            if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
+            if ((val = virDomainOnOffTypeFromString(ioeventfd)) <= 0) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("unknown interface ioeventfd mode '%s'"),
                                ioeventfd);
@@ -6987,7 +6955,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         }
         if (event_idx) {
             int idx;
-            if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
+            if ((idx = virDomainOnOffTypeFromString(event_idx)) <= 0) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("unknown interface event_idx mode '%s'"),
                                event_idx);
@@ -8731,7 +8699,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
                     }
 
                     if ((compressionVal =
-                         virDomainGraphicsSpicePlaybackCompressionTypeFromString(compression)) <= 0) {
+                         virDomainOnOffTypeFromString(compression)) <= 0) {
                         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                        _("unknown spice playback compression"));
                         VIR_FREE(compression);
@@ -11356,7 +11324,7 @@ virDomainDefParseXML(xmlDocPtr xml,
 
     /* and info about it */
     if ((tmp = virXPathString("string(./memory[1]/@dumpCore)", ctxt)) &&
-        (def->mem.dump_core = virDomainMemDumpTypeFromString(tmp)) <= 0) {
+        (def->mem.dump_core = virDomainOnOffTypeFromString(tmp)) <= 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Invalid memory core dump attribute value '%s'"), tmp);
         goto error;
@@ -11825,7 +11793,7 @@ virDomainDefParseXML(xmlDocPtr xml,
         case VIR_DOMAIN_FEATURE_APIC:
             if ((tmp = virXPathString("string(./features/apic/@eoi)", ctxt))) {
                 int eoi;
-                if ((eoi = virDomainFeatureStateTypeFromString(tmp)) <= 0) {
+                if ((eoi = virDomainOnOffTypeFromString(tmp)) <= 0) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("unknown value for attribute eoi: '%s'"),
                                    tmp);
@@ -11841,14 +11809,14 @@ virDomainDefParseXML(xmlDocPtr xml,
         case VIR_DOMAIN_FEATURE_VIRIDIAN:
         case VIR_DOMAIN_FEATURE_PRIVNET:
         case VIR_DOMAIN_FEATURE_HYPERV:
-            def->features[val] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[val] = VIR_DOMAIN_ON_OFF_ENABLED;
             break;
 
         case VIR_DOMAIN_FEATURE_PVSPINLOCK:
             node = ctxt->node;
             ctxt->node = nodes[i];
             if ((tmp = virXPathString("string(./@state)", ctxt))) {
-                if ((def->features[val] = virDomainFeatureStateTypeFromString(tmp)) == -1) {
+                if ((def->features[val] = virDomainOnOffTypeFromString(tmp)) == -1) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("unknown state attribute '%s' of feature '%s'"),
                                    tmp, virDomainFeatureTypeToString(val));
@@ -11856,7 +11824,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                 }
                 VIR_FREE(tmp);
             } else {
-                def->features[val] = VIR_DOMAIN_FEATURE_STATE_ON;
+                def->features[val] = VIR_DOMAIN_ON_OFF_ENABLED;
             }
             ctxt->node = node;
             break;
@@ -11867,7 +11835,7 @@ virDomainDefParseXML(xmlDocPtr xml,
     }
     VIR_FREE(nodes);
 
-    if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_DOMAIN_FEATURE_STATE_ON) {
+    if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_DOMAIN_ON_OFF_ENABLED) {
         int feature;
         int value;
         node = ctxt->node;
@@ -11896,7 +11864,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                         goto error;
                     }
 
-                    if ((value = virDomainFeatureStateTypeFromString(tmp)) < 0) {
+                    if ((value = virDomainOnOffTypeFromString(tmp)) < 0) {
                         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                        _("invalid value of state argument "
                                          "for HyperV Enlightenment feature '%s'"),
@@ -11917,7 +11885,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                         goto error;
                     }
 
-                    if ((value = virDomainFeatureStateTypeFromString(tmp)) < 0) {
+                    if ((value = virDomainOnOffTypeFromString(tmp)) < 0) {
                         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                        _("invalid value of state argument "
                                          "for HyperV Enlightenment feature '%s'"),
@@ -11926,7 +11894,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                     }
 
                     VIR_FREE(tmp);
-                    if (value == VIR_DOMAIN_FEATURE_STATE_ON) {
+                    if (value == VIR_DOMAIN_ON_OFF_ENABLED) {
                         if (virXPathUInt("string(./@retries)", ctxt,
                                      &def->hyperv_spinlocks) < 0) {
                             virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -13917,8 +13885,8 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
                            _("State of feature '%s' differs: "
                              "source: '%s', destination: '%s'"),
                            virDomainFeatureTypeToString(i),
-                           virDomainFeatureStateTypeToString(src->features[i]),
-                           virDomainFeatureStateTypeToString(dst->features[i]));
+                           virDomainOnOffTypeToString(src->features[i]),
+                           virDomainOnOffTypeToString(dst->features[i]));
             return false;
         }
     }
@@ -13928,13 +13896,13 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("State of APIC EOI differs: "
                          "source: '%s', destination: '%s'"),
-                       virDomainFeatureStateTypeToString(src->apic_eoi),
-                       virDomainFeatureStateTypeToString(dst->apic_eoi));
+                       virDomainOnOffTypeToString(src->apic_eoi),
+                       virDomainOnOffTypeToString(dst->apic_eoi));
         return false;
     }
 
     /* hyperv */
-    if (src->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_DOMAIN_FEATURE_STATE_ON) {
+    if (src->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_DOMAIN_ON_OFF_ENABLED) {
         for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
             switch ((virDomainHyperv) i) {
             case VIR_DOMAIN_HYPERV_RELAXED:
@@ -13945,8 +13913,8 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
                                      "feature '%s' differs: "
                                      "source: '%s', destination: '%s'"),
                                    virDomainHypervTypeToString(i),
-                                   virDomainFeatureStateTypeToString(src->hyperv_features[i]),
-                                   virDomainFeatureStateTypeToString(dst->hyperv_features[i]));
+                                   virDomainOnOffTypeToString(src->hyperv_features[i]),
+                                   virDomainOnOffTypeToString(dst->hyperv_features[i]));
                     return false;
                 }
 
@@ -15050,9 +15018,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
     const char *error_policy = virDomainDiskErrorPolicyTypeToString(def->error_policy);
     const char *rerror_policy = virDomainDiskErrorPolicyTypeToString(def->rerror_policy);
     const char *iomode = virDomainDiskIoTypeToString(def->iomode);
-    const char *ioeventfd = virDomainIoEventFdTypeToString(def->ioeventfd);
-    const char *event_idx = virDomainVirtioEventIdxTypeToString(def->event_idx);
-    const char *copy_on_read = virDomainDiskCopyOnReadTypeToString(def->copy_on_read);
+    const char *ioeventfd = virDomainOnOffTypeToString(def->ioeventfd);
+    const char *event_idx = virDomainOnOffTypeToString(def->event_idx);
+    const char *copy_on_read = virDomainOnOffTypeToString(def->copy_on_read);
     const char *sgio = virDomainDeviceSGIOTypeToString(def->sgio);
     const char *discard = virDomainDiskDiscardTypeToString(def->discard);
 
@@ -15193,9 +15161,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
         virBufferAsprintf(buf, " tray='%s'",
                           virDomainDiskTrayTypeToString(def->tray_status));
     if (def->bus == VIR_DOMAIN_DISK_BUS_USB &&
-        def->removable != VIR_DOMAIN_FEATURE_STATE_DEFAULT) {
+        def->removable != VIR_DOMAIN_ON_OFF_DEFAULT) {
         virBufferAsprintf(buf, " removable='%s'",
-                          virDomainFeatureStateTypeToString(def->removable));
+                          virDomainOnOffTypeToString(def->removable));
     }
     virBufferAddLit(buf, "/>\n");
 
@@ -15877,11 +15845,11 @@ virDomainNetDefFormat(virBufferPtr buf,
             }
             if (def->driver.virtio.ioeventfd) {
                 virBufferAsprintf(buf, " ioeventfd='%s'",
-                                  virDomainIoEventFdTypeToString(def->driver.virtio.ioeventfd));
+                                  virDomainOnOffTypeToString(def->driver.virtio.ioeventfd));
             }
             if (def->driver.virtio.event_idx) {
                 virBufferAsprintf(buf, " event_idx='%s'",
-                                  virDomainVirtioEventIdxTypeToString(def->driver.virtio.event_idx));
+                                  virDomainOnOffTypeToString(def->driver.virtio.event_idx));
             }
             if (def->driver.virtio.queues)
                 virBufferAsprintf(buf, " queues='%u'", def->driver.virtio.queues);
@@ -16917,7 +16885,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
                               virDomainGraphicsSpiceZlibCompressionTypeToString(def->data.spice.zlib));
         if (def->data.spice.playback)
             virBufferAsprintf(buf, "<playback compression='%s'/>\n",
-                              virDomainGraphicsSpicePlaybackCompressionTypeToString(def->data.spice.playback));
+                              virDomainOnOffTypeToString(def->data.spice.playback));
         if (def->data.spice.streaming)
             virBufferAsprintf(buf, "<streaming mode='%s'/>\n",
                               virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
@@ -17237,7 +17205,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
     virBufferAddLit(buf, "<memory");
     if (def->mem.dump_core)
         virBufferAsprintf(buf, " dumpCore='%s'",
-                          virDomainMemDumpTypeToString(def->mem.dump_core));
+                          virDomainOnOffTypeToString(def->mem.dump_core));
     virBufferAsprintf(buf, " unit='KiB'>%llu</memory>\n",
                       def->mem.max_balloon);
 
@@ -17565,7 +17533,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
     }
 
     for (i = 0; i < VIR_DOMAIN_FEATURE_LAST; i++) {
-        if (def->features[i] != VIR_DOMAIN_FEATURE_STATE_DEFAULT)
+        if (def->features[i] != VIR_DOMAIN_ON_OFF_DEFAULT)
             break;
     }
 
@@ -17589,16 +17557,16 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             case VIR_DOMAIN_FEATURE_HAP:
             case VIR_DOMAIN_FEATURE_VIRIDIAN:
             case VIR_DOMAIN_FEATURE_PRIVNET:
-                switch ((virDomainFeatureState) def->features[i]) {
-                case VIR_DOMAIN_FEATURE_STATE_DEFAULT:
+                switch ((virDomainOnOff) def->features[i]) {
+                case VIR_DOMAIN_ON_OFF_DEFAULT:
                     break;
 
-                case VIR_DOMAIN_FEATURE_STATE_ON:
+                case VIR_DOMAIN_ON_OFF_ENABLED:
                    virBufferAsprintf(buf, "<%s/>\n", name);
                    break;
 
-                case VIR_DOMAIN_FEATURE_STATE_LAST:
-                case VIR_DOMAIN_FEATURE_STATE_OFF:
+                case VIR_DOMAIN_ON_OFF_LAST:
+                case VIR_DOMAIN_ON_OFF_DISABLED:
                    virReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("Unexpected state of feature '%s'"), name);
 
@@ -17609,16 +17577,16 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                 break;
 
             case VIR_DOMAIN_FEATURE_PVSPINLOCK:
-                switch ((virDomainFeatureState) def->features[i]) {
-                case VIR_DOMAIN_FEATURE_STATE_LAST:
-                case VIR_DOMAIN_FEATURE_STATE_DEFAULT:
+                switch ((virDomainOnOff) def->features[i]) {
+                case VIR_DOMAIN_ON_OFF_LAST:
+                case VIR_DOMAIN_ON_OFF_DEFAULT:
                     break;
 
-                case VIR_DOMAIN_FEATURE_STATE_ON:
+                case VIR_DOMAIN_ON_OFF_ENABLED:
                    virBufferAsprintf(buf, "<%s state='on'/>\n", name);
                    break;
 
-                case VIR_DOMAIN_FEATURE_STATE_OFF:
+                case VIR_DOMAIN_ON_OFF_DISABLED:
                    virBufferAsprintf(buf, "<%s state='off'/>\n", name);
                    break;
                 }
@@ -17626,18 +17594,18 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                 break;
 
             case VIR_DOMAIN_FEATURE_APIC:
-                if (def->features[i] == VIR_DOMAIN_FEATURE_STATE_ON) {
+                if (def->features[i] == VIR_DOMAIN_ON_OFF_ENABLED) {
                     virBufferAddLit(buf, "<apic");
                     if (def->apic_eoi) {
                         virBufferAsprintf(buf, " eoi='%s'",
-                                          virDomainFeatureStateTypeToString(def->apic_eoi));
+                                          virDomainOnOffTypeToString(def->apic_eoi));
                     }
                     virBufferAddLit(buf, "/>\n");
                 }
                 break;
 
             case VIR_DOMAIN_FEATURE_HYPERV:
-                if (def->features[i] != VIR_DOMAIN_FEATURE_STATE_ON)
+                if (def->features[i] != VIR_DOMAIN_ON_OFF_ENABLED)
                     break;
 
                 virBufferAddLit(buf, "<hyperv>\n");
@@ -17649,7 +17617,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                         if (def->hyperv_features[j])
                             virBufferAsprintf(buf, "<%s state='%s'/>\n",
                                               virDomainHypervTypeToString(j),
-                                              virDomainFeatureStateTypeToString(
+                                              virDomainOnOffTypeToString(
                                                   def->hyperv_features[j]));
                         break;
 
@@ -17658,9 +17626,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                             break;
 
                         virBufferAsprintf(buf, "<spinlocks state='%s'",
-                                          virDomainFeatureStateTypeToString(
+                                          virDomainOnOffTypeToString(
                                               def->hyperv_features[j]));
-                        if (def->hyperv_features[j] == VIR_DOMAIN_FEATURE_STATE_ON)
+                        if (def->hyperv_features[j] == VIR_DOMAIN_ON_OFF_ENABLED)
                             virBufferAsprintf(buf, " retries='%d'",
                                               def->hyperv_spinlocks);
                         virBufferAddLit(buf, "/>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 29c63af..086de3e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -130,6 +130,14 @@ typedef virDomainIdMapDef *virDomainIdMapDefPtr;
 typedef struct _virDomainPanicDef virDomainPanicDef;
 typedef virDomainPanicDef *virDomainPanicDefPtr;
 
+typedef enum {
+    VIR_DOMAIN_ON_OFF_DEFAULT = 0,
+    VIR_DOMAIN_ON_OFF_ENABLED,
+    VIR_DOMAIN_ON_OFF_DISABLED,
+
+    VIR_DOMAIN_ON_OFF_LAST
+} virDomainOnOff;
+
 /* Flags for the 'type' field in virDomainDeviceDef */
 typedef enum {
     VIR_DOMAIN_DEVICE_NONE = 0,
@@ -218,14 +226,6 @@ typedef enum {
     VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
 } virDomainDeviceAddressType;
 
-typedef enum {
-    VIR_DOMAIN_PCI_ROMBAR_DEFAULT = 0,
-    VIR_DOMAIN_PCI_ROMBAR_ON,
-    VIR_DOMAIN_PCI_ROMBAR_OFF,
-
-    VIR_DOMAIN_PCI_ROMBAR_LAST
-} virDomainPCIRombarMode;
-
 typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
 typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
 struct _virDomainDeviceDriveAddress {
@@ -535,30 +535,6 @@ typedef enum {
 } virDomainDiskIo;
 
 typedef enum {
-    VIR_DOMAIN_IO_EVENT_FD_DEFAULT = 0,
-    VIR_DOMAIN_IO_EVENT_FD_ON,
-    VIR_DOMAIN_IO_EVENT_FD_OFF,
-
-    VIR_DOMAIN_IO_EVENT_FD_LAST
-} virDomainIoEventFd;
-
-typedef enum {
-    VIR_DOMAIN_VIRTIO_EVENT_IDX_DEFAULT = 0,
-    VIR_DOMAIN_VIRTIO_EVENT_IDX_ON,
-    VIR_DOMAIN_VIRTIO_EVENT_IDX_OFF,
-
-    VIR_DOMAIN_VIRTIO_EVENT_IDX_LAST
-} virDomainVirtioEventIdx;
-
-typedef enum {
-    VIR_DOMAIN_DISK_COPY_ON_READ_DEFAULT = 0,
-    VIR_DOMAIN_DISK_COPY_ON_READ_ON,
-    VIR_DOMAIN_DISK_COPY_ON_READ_OFF,
-
-    VIR_DOMAIN_DISK_COPY_ON_READ_LAST
-} virDomainDiskCopyOnRead;
-
-typedef enum {
     VIR_DOMAIN_STARTUP_POLICY_DEFAULT = 0,
     VIR_DOMAIN_STARTUP_POLICY_MANDATORY,
     VIR_DOMAIN_STARTUP_POLICY_REQUISITE,
@@ -604,7 +580,7 @@ struct _virDomainDiskDef {
     int bus; /* enum virDomainDiskBus */
     char *dst;
     int tray_status; /* enum virDomainDiskTray */
-    int removable; /* enum virDomainFeatureState */
+    int removable; /* enum virDomainOnOff */
 
     virStorageSourcePtr mirror;
     bool mirroring;
@@ -865,8 +841,8 @@ struct _virDomainNetDef {
         struct {
             virDomainNetBackendType name; /* which driver backend to use */
             virDomainNetVirtioTxModeType txmode;
-            virDomainIoEventFd ioeventfd;
-            virDomainVirtioEventIdx event_idx;
+            virDomainOnOff ioeventfd;
+            virDomainOnOff event_idx;
             unsigned int queues; /* Multiqueue virtio-net */
         } virtio;
     } driver;
@@ -1312,14 +1288,6 @@ typedef enum {
 } virDomainGraphicsSpiceZlibCompression;
 
 typedef enum {
-    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_DEFAULT = 0,
-    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_ON,
-    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_OFF,
-
-    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
-} virDomainGraphicsSpicePlaybackCompression;
-
-typedef enum {
     VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
     VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
     VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT,
@@ -1448,14 +1416,6 @@ struct _virDomainRedirFilterDef {
     virDomainRedirFilterUSBDevDefPtr *usbdevs;
 };
 
-typedef enum {
-    VIR_DOMAIN_MEM_DUMP_DEFAULT = 0,
-    VIR_DOMAIN_MEM_DUMP_ON,
-    VIR_DOMAIN_MEM_DUMP_OFF,
-
-    VIR_DOMAIN_MEM_DUMP_LAST,
-} virDomainMemDump;
-
 enum {
     VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
     VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
@@ -1517,14 +1477,6 @@ typedef enum {
 } virDomainFeature;
 
 typedef enum {
-    VIR_DOMAIN_FEATURE_STATE_DEFAULT = 0,
-    VIR_DOMAIN_FEATURE_STATE_ON,
-    VIR_DOMAIN_FEATURE_STATE_OFF,
-
-    VIR_DOMAIN_FEATURE_STATE_LAST
-} virDomainFeatureState;
-
-typedef enum {
     VIR_DOMAIN_HYPERV_RELAXED = 0,
     VIR_DOMAIN_HYPERV_VAPIC,
     VIR_DOMAIN_HYPERV_SPINLOCKS,
@@ -1881,9 +1833,9 @@ struct _virDomainDef {
     virDomainOSDef os;
     char *emulator;
     int features[VIR_DOMAIN_FEATURE_LAST];
-    /* enum virDomainFeatureState */
+    /* enum virDomainOnOff */
     int apic_eoi;
-    /* These options are of type virDomainFeatureState */
+    /* These options are of type virDomainOnOff */
     int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
     unsigned int hyperv_spinlocks;
 
@@ -2503,7 +2455,7 @@ VIR_ENUM_DECL(virDomainVirt)
 VIR_ENUM_DECL(virDomainBoot)
 VIR_ENUM_DECL(virDomainYesNo)
 VIR_ENUM_DECL(virDomainFeature)
-VIR_ENUM_DECL(virDomainFeatureState)
+VIR_ENUM_DECL(virDomainOnOff)
 VIR_ENUM_DECL(virDomainLifecycle)
 VIR_ENUM_DECL(virDomainLifecycleCrash)
 VIR_ENUM_DECL(virDomainDevice)
@@ -2517,9 +2469,6 @@ VIR_ENUM_DECL(virDomainDiskIo)
 VIR_ENUM_DECL(virDomainDeviceSGIO)
 VIR_ENUM_DECL(virDomainDiskTray)
 VIR_ENUM_DECL(virDomainDiskDiscard)
-VIR_ENUM_DECL(virDomainIoEventFd)
-VIR_ENUM_DECL(virDomainVirtioEventIdx)
-VIR_ENUM_DECL(virDomainDiskCopyOnRead)
 VIR_ENUM_DECL(virDomainController)
 VIR_ENUM_DECL(virDomainControllerModelPCI)
 VIR_ENUM_DECL(virDomainControllerModelSCSI)
@@ -2542,7 +2491,6 @@ VIR_ENUM_DECL(virDomainChrTcpProtocol)
 VIR_ENUM_DECL(virDomainChrSpicevmc)
 VIR_ENUM_DECL(virDomainSoundCodec)
 VIR_ENUM_DECL(virDomainSoundModel)
-VIR_ENUM_DECL(virDomainMemDump)
 VIR_ENUM_DECL(virDomainMemballoonModel)
 VIR_ENUM_DECL(virDomainSmbiosMode)
 VIR_ENUM_DECL(virDomainWatchdogModel)
@@ -2551,7 +2499,6 @@ VIR_ENUM_DECL(virDomainVideo)
 VIR_ENUM_DECL(virDomainHostdevMode)
 VIR_ENUM_DECL(virDomainHostdevSubsys)
 VIR_ENUM_DECL(virDomainHostdevCaps)
-VIR_ENUM_DECL(virDomainPCIRombarMode)
 VIR_ENUM_DECL(virDomainHub)
 VIR_ENUM_DECL(virDomainRedirdevBus)
 VIR_ENUM_DECL(virDomainInput)
@@ -2564,7 +2511,6 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode)
 VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
 VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression)
 VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
-VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression)
 VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
 VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode)
 VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d1adaa2..61f78a2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -217,8 +217,6 @@ virDomainDeviceTypeToString;
 virDomainDiskBusTypeToString;
 virDomainDiskCacheTypeFromString;
 virDomainDiskCacheTypeToString;
-virDomainDiskCopyOnReadTypeFromString;
-virDomainDiskCopyOnReadTypeToString;
 virDomainDiskDefAssignAddress;
 virDomainDiskDefForeachPath;
 virDomainDiskDefFree;
@@ -249,8 +247,6 @@ virDomainDiskSetType;
 virDomainDiskSourceIsBlockType;
 virDomainEmulatorPinAdd;
 virDomainEmulatorPinDel;
-virDomainFeatureStateTypeFromString;
-virDomainFeatureStateTypeToString;
 virDomainFSDefFree;
 virDomainFSIndexByName;
 virDomainFSInsert;
@@ -279,8 +275,6 @@ virDomainGraphicsSpiceJpegCompressionTypeFromString;
 virDomainGraphicsSpiceJpegCompressionTypeToString;
 virDomainGraphicsSpiceMouseModeTypeFromString;
 virDomainGraphicsSpiceMouseModeTypeToString;
-virDomainGraphicsSpicePlaybackCompressionTypeFromString;
-virDomainGraphicsSpicePlaybackCompressionTypeToString;
 virDomainGraphicsSpiceStreamingModeTypeFromString;
 virDomainGraphicsSpiceStreamingModeTypeToString;
 virDomainGraphicsSpiceZlibCompressionTypeFromString;
@@ -305,8 +299,6 @@ virDomainHubTypeToString;
 virDomainHypervTypeFromString;
 virDomainHypervTypeToString;
 virDomainInputDefFree;
-virDomainIoEventFdTypeFromString;
-virDomainIoEventFdTypeToString;
 virDomainLeaseDefFree;
 virDomainLeaseIndex;
 virDomainLeaseInsert;
@@ -323,8 +315,6 @@ virDomainLockFailureTypeFromString;
 virDomainLockFailureTypeToString;
 virDomainMemballoonModelTypeFromString;
 virDomainMemballoonModelTypeToString;
-virDomainMemDumpTypeFromString;
-virDomainMemDumpTypeToString;
 virDomainNetDefFormat;
 virDomainNetDefFree;
 virDomainNetFind;
@@ -367,10 +357,10 @@ virDomainObjSetDefTransient;
 virDomainObjSetMetadata;
 virDomainObjSetState;
 virDomainObjTaint;
+virDomainOnOffTypeFromString;
+virDomainOnOffTypeToString;
 virDomainPausedReasonTypeFromString;
 virDomainPausedReasonTypeToString;
-virDomainPCIRombarModeTypeFromString;
-virDomainPCIRombarModeTypeToString;
 virDomainPMSuspendedReasonTypeFromString;
 virDomainPMSuspendedReasonTypeToString;
 virDomainRedirdevBusTypeFromString;
@@ -430,8 +420,6 @@ virDomainVideoDefaultType;
 virDomainVideoDefFree;
 virDomainVideoTypeFromString;
 virDomainVideoTypeToString;
-virDomainVirtioEventIdxTypeFromString;
-virDomainVirtioEventIdxTypeToString;
 virDomainVirtTypeFromString;
 virDomainVirtTypeToString;
 virDomainWatchdogActionTypeFromString;
@@ -440,6 +428,8 @@ virDomainWatchdogModelTypeFromString;
 virDomainWatchdogModelTypeToString;
 virDomainXMLOptionGetNamespace;
 virDomainXMLOptionNew;
+virDomainYesNoTypeFromString;
+virDomainYesNoTypeToString;
 
 
 # conf/domain_event.h
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f620d47..7e7aae6 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -612,13 +612,13 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
 
         libxl_defbool_set(&b_info->u.hvm.pae,
                           def->features[VIR_DOMAIN_FEATURE_PAE] ==
-                          VIR_DOMAIN_FEATURE_STATE_ON);
+                          VIR_DOMAIN_ON_OFF_ENABLED);
         libxl_defbool_set(&b_info->u.hvm.apic,
                           def->features[VIR_DOMAIN_FEATURE_APIC] ==
-                          VIR_DOMAIN_FEATURE_STATE_ON);
+                          VIR_DOMAIN_ON_OFF_ENABLED);
         libxl_defbool_set(&b_info->u.hvm.acpi,
                           def->features[VIR_DOMAIN_FEATURE_ACPI] ==
-                          VIR_DOMAIN_FEATURE_STATE_ON);
+                          VIR_DOMAIN_ON_OFF_ENABLED);
         for (i = 0; i < def->clock.ntimers; i++) {
             if (def->clock.timers[i]->name == VIR_DOMAIN_TIMER_NAME_HPET &&
                 def->clock.timers[i]->present == 1) {
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 4d89677..0269eb4 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1867,7 +1867,7 @@ static int lxcContainerChild(void *data)
 
     /* rename and enable interfaces */
     if (lxcContainerRenameAndEnableInterfaces(vmDef->features[VIR_DOMAIN_FEATURE_PRIVNET] ==
-                                              VIR_DOMAIN_FEATURE_STATE_ON,
+                                              VIR_DOMAIN_ON_OFF_ENABLED,
                                               argv->nveths,
                                               argv->veths) < 0) {
         goto cleanup;
@@ -1957,7 +1957,7 @@ lxcNeedNetworkNamespace(virDomainDefPtr def)
     size_t i;
     if (def->nets != NULL)
         return true;
-    if (def->features[VIR_DOMAIN_FEATURE_PRIVNET] == VIR_DOMAIN_FEATURE_STATE_ON)
+    if (def->features[VIR_DOMAIN_FEATURE_PRIVNET] == VIR_DOMAIN_ON_OFF_ENABLED)
         return true;
     for (i = 0; i < def->nhostdevs; i++) {
         if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES &&
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index f4c4556..83dc87b 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -553,7 +553,7 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
 
     if (data.networks == 0 && data.privnet) {
         /* When no network type is provided LXC only adds loopback */
-        def->features[VIR_DOMAIN_FEATURE_PRIVNET] = VIR_DOMAIN_FEATURE_STATE_ON;
+        def->features[VIR_DOMAIN_FEATURE_PRIVNET] = VIR_DOMAIN_ON_OFF_ENABLED;
     }
 
     return 0;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 335a91c..56280de 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2424,10 +2424,10 @@ qemuBuildRomStr(virBufferPtr buf,
         }
 
         switch (info->rombar) {
-        case VIR_DOMAIN_PCI_ROMBAR_OFF:
+        case VIR_DOMAIN_ON_OFF_DISABLED:
             virBufferAddLit(buf, ",rombar=0");
             break;
-        case VIR_DOMAIN_PCI_ROMBAR_ON:
+        case VIR_DOMAIN_ON_OFF_ENABLED:
             virBufferAddLit(buf, ",rombar=1");
             break;
         default:
@@ -2441,12 +2441,12 @@ qemuBuildRomStr(virBufferPtr buf,
 
 static int
 qemuBuildIoEventFdStr(virBufferPtr buf,
-                      virDomainIoEventFd use,
+                      virDomainOnOff use,
                       virQEMUCapsPtr qemuCaps)
 {
     if (use && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOEVENTFD))
         virBufferAsprintf(buf, ",ioeventfd=%s",
-                          virDomainIoEventFdTypeToString(use));
+                          virDomainOnOffTypeToString(use));
     return 0;
 }
 
@@ -3495,7 +3495,7 @@ qemuBuildDriveStr(virConnectPtr conn,
     if (disk->copy_on_read) {
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ)) {
             virBufferAsprintf(&opt, ",copy-on-read=%s",
-                              virDomainDiskCopyOnReadTypeToString(disk->copy_on_read));
+                              virDomainOnOffTypeToString(disk->copy_on_read));
         } else {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("copy_on_read is not supported by this QEMU binary"));
@@ -3862,7 +3862,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
         if (disk->event_idx &&
             virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX)) {
             virBufferAsprintf(&opt, ",event_idx=%s",
-                              virDomainVirtioEventIdxTypeToString(disk->event_idx));
+                              virDomainOnOffTypeToString(disk->event_idx));
         }
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) {
             /* if sg_io is true but the scsi option isn't supported,
@@ -3921,12 +3921,12 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
 
     if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_REMOVABLE)) {
-            if (disk->removable == VIR_DOMAIN_FEATURE_STATE_ON)
+            if (disk->removable == VIR_DOMAIN_ON_OFF_ENABLED)
                 virBufferAddLit(&opt, ",removable=on");
             else
                 virBufferAddLit(&opt, ",removable=off");
         } else {
-            if (disk->removable != VIR_DOMAIN_FEATURE_STATE_DEFAULT) {
+            if (disk->removable != VIR_DOMAIN_ON_OFF_DEFAULT) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("This QEMU doesn't support setting the "
                                  "removable flag of USB storage devices"));
@@ -4371,7 +4371,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
         if (net->driver.virtio.event_idx &&
             virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_EVENT_IDX)) {
             virBufferAsprintf(&buf, ",event_idx=%s",
-                              virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx));
+                              virDomainOnOffTypeToString(net->driver.virtio.event_idx));
         }
     }
     if (usingVirtio && vhostfdSize > 1) {
@@ -6115,7 +6115,7 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
 
     if (def->apic_eoi) {
         char sign;
-        if (def->apic_eoi == VIR_DOMAIN_FEATURE_STATE_ON)
+        if (def->apic_eoi == VIR_DOMAIN_ON_OFF_ENABLED)
             sign = '+';
         else
             sign = '-';
@@ -6128,7 +6128,7 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
 
     if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK]) {
         char sign;
-        if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_DOMAIN_FEATURE_STATE_ON)
+        if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_DOMAIN_ON_OFF_ENABLED)
             sign = '+';
         else
             sign = '-';
@@ -6139,7 +6139,7 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
         have_cpu = true;
     }
 
-    if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_DOMAIN_FEATURE_STATE_ON) {
+    if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_DOMAIN_ON_OFF_ENABLED) {
         if (!have_cpu) {
             virBufferAdd(&buf, default_model, -1);
             have_cpu = true;
@@ -6149,13 +6149,13 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
             switch ((virDomainHyperv) i) {
             case VIR_DOMAIN_HYPERV_RELAXED:
             case VIR_DOMAIN_HYPERV_VAPIC:
-                if (def->hyperv_features[i] == VIR_DOMAIN_FEATURE_STATE_ON)
+                if (def->hyperv_features[i] == VIR_DOMAIN_ON_OFF_ENABLED)
                     virBufferAsprintf(&buf, ",hv_%s",
                                       virDomainHypervTypeToString(i));
                 break;
 
             case VIR_DOMAIN_HYPERV_SPINLOCKS:
-                if (def->hyperv_features[i] == VIR_DOMAIN_FEATURE_STATE_ON)
+                if (def->hyperv_features[i] == VIR_DOMAIN_ON_OFF_ENABLED)
                     virBufferAsprintf(&buf, ",hv_spinlocks=0x%x",
                                       def->hyperv_spinlocks);
                 break;
@@ -6312,7 +6312,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
             }
 
             virBufferAsprintf(&buf, ",dump-guest-core=%s",
-                              virDomainMemDumpTypeToString(def->mem.dump_core));
+                              virDomainOnOffTypeToString(def->mem.dump_core));
         }
 
         if (def->mem.nosharepages) {
@@ -6750,7 +6750,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
                           virDomainGraphicsSpiceZlibCompressionTypeToString(graphics->data.spice.zlib));
     if (graphics->data.spice.playback)
         virBufferAsprintf(&opt, ",playback-compression=%s",
-                          virDomainGraphicsSpicePlaybackCompressionTypeToString(graphics->data.spice.playback));
+                          virDomainOnOffTypeToString(graphics->data.spice.playback));
     if (graphics->data.spice.streaming)
         virBufferAsprintf(&opt, ",streaming-video=%s",
                           virDomainGraphicsSpiceStreamingModeTypeToString(graphics->data.spice.streaming));
@@ -7543,7 +7543,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) {
-        if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_DOMAIN_FEATURE_STATE_ON)
+        if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_DOMAIN_ON_OFF_ENABLED)
             virCommandAddArg(cmd, "-no-acpi");
     }
 
@@ -10347,9 +10347,9 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
                 }
             } else if (STREQ(feature, "kvm_pv_eoi")) {
                 if (policy == VIR_CPU_FEATURE_REQUIRE)
-                    dom->apic_eoi = VIR_DOMAIN_FEATURE_STATE_ON;
+                    dom->apic_eoi = VIR_DOMAIN_ON_OFF_ENABLED;
                 else
-                    dom->apic_eoi = VIR_DOMAIN_FEATURE_STATE_OFF;
+                    dom->apic_eoi = VIR_DOMAIN_ON_OFF_DISABLED;
             } else {
                 if (!cpu) {
                     if (!(cpu = qemuInitGuestCPU(dom)))
@@ -10379,7 +10379,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
             if (*feature == '\0')
                 goto syntax;
 
-            dom->features[VIR_DOMAIN_FEATURE_HYPERV] = VIR_DOMAIN_FEATURE_STATE_ON;
+            dom->features[VIR_DOMAIN_FEATURE_HYPERV] = VIR_DOMAIN_ON_OFF_ENABLED;
 
             if ((f = virDomainHypervTypeFromString(feature)) < 0) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -10397,11 +10397,11 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
                                      "have a value"), feature);
                     goto cleanup;
                 }
-                dom->hyperv_features[f] = VIR_DOMAIN_FEATURE_STATE_ON;
+                dom->hyperv_features[f] = VIR_DOMAIN_ON_OFF_ENABLED;
                 break;
 
             case VIR_DOMAIN_HYPERV_SPINLOCKS:
-                dom->hyperv_features[f] = VIR_DOMAIN_FEATURE_STATE_ON;
+                dom->hyperv_features[f] = VIR_DOMAIN_ON_OFF_ENABLED;
                 if (!value) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("missing HyperV spinlock retry count"));
@@ -10634,7 +10634,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
             goto error;
         if (strstr(path, "kvm")) {
             def->virtType = VIR_DOMAIN_VIRT_KVM;
-            def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_ON_OFF_ENABLED;
         }
     }
 
@@ -10647,7 +10647,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
 
     if ((def->os.arch == VIR_ARCH_I686) ||
         (def->os.arch == VIR_ARCH_X86_64))
-        def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_FEATURE_STATE_ON;
+        def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_ON_OFF_ENABLED;
 
 #define WANT_VALUE()                                                   \
     const char *val = progargv[++i];                                   \
@@ -10953,7 +10953,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
             if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0)
                 goto error;
         } else if (STREQ(arg, "-no-acpi")) {
-            def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_FEATURE_STATE_DEFAULT;
+            def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_ON_OFF_DEFAULT;
         } else if (STREQ(arg, "-no-reboot")) {
             def->onReboot = VIR_DOMAIN_LIFECYCLE_DESTROY;
         } else if (STREQ(arg, "-no-kvm")) {
@@ -11065,14 +11065,14 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
             while ((param = list[j++])) {
                 if (STRPREFIX(param, "dump-guest-core=")) {
                     param += strlen("dump-guest-core=");
-                    def->mem.dump_core = virDomainMemDumpTypeFromString(param);
+                    def->mem.dump_core = virDomainOnOffTypeFromString(param);
                     if (def->mem.dump_core <= 0)
-                        def->mem.dump_core = VIR_DOMAIN_MEM_DUMP_DEFAULT;
+                        def->mem.dump_core = VIR_DOMAIN_ON_OFF_DEFAULT;
                 } else if (STRPREFIX(param, "mem-merge=off")) {
                     def->mem.nosharepages = true;
                 } else if (STRPREFIX(param, "accel=kvm")) {
                     def->virtType = VIR_DOMAIN_VIRT_KVM;
-                    def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_FEATURE_STATE_ON;
+                    def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_ON_OFF_ENABLED;
                 }
             }
             virStringFreeList(list);
@@ -11145,7 +11145,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
                     disk->src->type = VIR_STORAGE_TYPE_FILE;
                 disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
                 disk->bus = VIR_DOMAIN_DISK_BUS_USB;
-                disk->removable = VIR_DOMAIN_FEATURE_STATE_DEFAULT;
+                disk->removable = VIR_DOMAIN_ON_OFF_DEFAULT;
                 if (VIR_STRDUP(disk->dst, "sda") < 0)
                     goto error;
                 if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ccc571b..cf05995 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3617,7 +3617,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
             goto cleanup;
         }
 
-        if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_DOMAIN_FEATURE_STATE_ON) {
+        if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_DOMAIN_ON_OFF_ENABLED) {
             if (!cpuHasFeature(guestcpu, VIR_CPU_x86_KVM_PV_UNHALT)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("host doesn't support paravirtual spinlocks"));
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 3825083..8bc5830 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2516,17 +2516,17 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
             machine->vtbl->GetCPUProperty(machine, CPUPropertyType_PAE, &PAEEnabled);
 #endif
             if (PAEEnabled)
-                def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_FEATURE_STATE_ON;
+                def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_ON_OFF_ENABLED;
 
             machine->vtbl->GetBIOSSettings(machine, &bios);
             if (bios) {
                 bios->vtbl->GetACPIEnabled(bios, &ACPIEnabled);
                 if (ACPIEnabled)
-                    def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_FEATURE_STATE_ON;
+                    def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_ON_OFF_ENABLED;
 
                 bios->vtbl->GetIOAPICEnabled(bios, &IOAPICEnabled);
                 if (IOAPICEnabled)
-                    def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_FEATURE_STATE_ON;
+                    def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_ON_OFF_ENABLED;
 
                 VBOX_RELEASE(bios);
             }
@@ -5222,20 +5222,20 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml)
 #if VBOX_API_VERSION < 3001000
     rc = machine->vtbl->SetPAEEnabled(machine,
                                       def->features[VIR_DOMAIN_FEATURE_PAE] ==
-                                      VIR_DOMAIN_FEATURE_STATE_ON);
+                                      VIR_DOMAIN_ON_OFF_ENABLED);
 #elif VBOX_API_VERSION == 3001000
     rc = machine->vtbl->SetCpuProperty(machine, CpuPropertyType_PAE,
                                        def->features[VIR_DOMAIN_FEATURE_PAE] ==
-                                       VIR_DOMAIN_FEATURE_STATE_ON);
+                                       VIR_DOMAIN_ON_OFF_ENABLED);
 #elif VBOX_API_VERSION >= 3002000
     rc = machine->vtbl->SetCPUProperty(machine, CPUPropertyType_PAE,
                                        def->features[VIR_DOMAIN_FEATURE_PAE] ==
-                                       VIR_DOMAIN_FEATURE_STATE_ON);
+                                       VIR_DOMAIN_ON_OFF_ENABLED);
 #endif
     if (NS_FAILED(rc)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("could not change PAE status to: %s, rc=%08x"),
-                       (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON)
+                       (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_ON_OFF_ENABLED)
                        ? _("Enabled") : _("Disabled"), (unsigned)rc);
     }
 
@@ -5243,20 +5243,20 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml)
     if (bios) {
         rc = bios->vtbl->SetACPIEnabled(bios,
                                         def->features[VIR_DOMAIN_FEATURE_ACPI] ==
-                                        VIR_DOMAIN_FEATURE_STATE_ON);
+                                        VIR_DOMAIN_ON_OFF_ENABLED);
         if (NS_FAILED(rc)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("could not change ACPI status to: %s, rc=%08x"),
-                           (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_DOMAIN_FEATURE_STATE_ON)
+                           (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_DOMAIN_ON_OFF_ENABLED)
                            ? _("Enabled") : _("Disabled"), (unsigned)rc);
         }
         rc = bios->vtbl->SetIOAPICEnabled(bios,
                                           def->features[VIR_DOMAIN_FEATURE_APIC] ==
-                                          VIR_DOMAIN_FEATURE_STATE_ON);
+                                          VIR_DOMAIN_ON_OFF_ENABLED);
         if (NS_FAILED(rc)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("could not change APIC status to: %s, rc=%08x"),
-                           (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_FEATURE_STATE_ON)
+                           (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_ON_OFF_ENABLED)
                            ? _("Enabled") : _("Disabled"), (unsigned)rc);
         }
         VBOX_RELEASE(bios);
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 9e59804..7e6eef0 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -1201,15 +1201,15 @@ xenParseSxpr(const struct sexpr *root,
 
     if (hvm) {
         if (sexpr_int(root, "domain/image/hvm/acpi"))
-            def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (sexpr_int(root, "domain/image/hvm/apic"))
-            def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (sexpr_int(root, "domain/image/hvm/pae"))
-            def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (sexpr_int(root, "domain/image/hvm/hap"))
-            def->features[VIR_DOMAIN_FEATURE_HAP] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_HAP] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (sexpr_int(root, "domain/image/hvm/viridian"))
-            def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] = VIR_DOMAIN_ON_OFF_ENABLED;
     }
 
     /* 12aaf4a2486b (3.0.3) added a second low-priority 'localtime' setting */
@@ -2338,15 +2338,15 @@ xenFormatSxpr(virConnectPtr conn,
                 }
             }
 
-            if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_DOMAIN_FEATURE_STATE_ON)
+            if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_DOMAIN_ON_OFF_ENABLED)
                 virBufferAddLit(&buf, "(acpi 1)");
-            if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_FEATURE_STATE_ON)
+            if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_ON_OFF_ENABLED)
                 virBufferAddLit(&buf, "(apic 1)");
-            if (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON)
+            if (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_ON_OFF_ENABLED)
                 virBufferAddLit(&buf, "(pae 1)");
-            if (def->features[VIR_DOMAIN_FEATURE_HAP] == VIR_DOMAIN_FEATURE_STATE_ON)
+            if (def->features[VIR_DOMAIN_FEATURE_HAP] == VIR_DOMAIN_ON_OFF_ENABLED)
                 virBufferAddLit(&buf, "(hap 1)");
-            if (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] == VIR_DOMAIN_FEATURE_STATE_ON)
+            if (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] == VIR_DOMAIN_ON_OFF_ENABLED)
                 virBufferAddLit(&buf, "(viridian 1)");
 
             virBufferAddLit(&buf, "(usb 1)");
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 25a042d..e4ce8b4 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -418,23 +418,23 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
         if (xenXMConfigGetBool(conf, "pae", &val, 0) < 0)
             goto cleanup;
         else if (val)
-            def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (xenXMConfigGetBool(conf, "acpi", &val, 0) < 0)
             goto cleanup;
         else if (val)
-            def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (xenXMConfigGetBool(conf, "apic", &val, 0) < 0)
             goto cleanup;
         else if (val)
-            def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (xenXMConfigGetBool(conf, "hap", &val, 0) < 0)
             goto cleanup;
         else if (val)
-            def->features[VIR_DOMAIN_FEATURE_HAP] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_HAP] = VIR_DOMAIN_ON_OFF_ENABLED;
         if (xenXMConfigGetBool(conf, "viridian", &val, 0) < 0)
             goto cleanup;
         else if (val)
-            def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] = VIR_DOMAIN_FEATURE_STATE_ON;
+            def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] = VIR_DOMAIN_ON_OFF_ENABLED;
 
         if (xenXMConfigGetBool(conf, "hpet", &val, -1) < 0)
             goto cleanup;
@@ -1589,28 +1589,28 @@ virConfPtr xenFormatXM(virConnectPtr conn,
 
         if (xenXMConfigSetInt(conf, "pae",
                               (def->features[VIR_DOMAIN_FEATURE_PAE] ==
-                               VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+                               VIR_DOMAIN_ON_OFF_ENABLED) ? 1 : 0) < 0)
             goto cleanup;
 
         if (xenXMConfigSetInt(conf, "acpi",
                               (def->features[VIR_DOMAIN_FEATURE_ACPI] ==
-                               VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+                               VIR_DOMAIN_ON_OFF_ENABLED) ? 1 : 0) < 0)
             goto cleanup;
 
         if (xenXMConfigSetInt(conf, "apic",
                               (def->features[VIR_DOMAIN_FEATURE_APIC] ==
-                               VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+                               VIR_DOMAIN_ON_OFF_ENABLED) ? 1 : 0) < 0)
             goto cleanup;
 
         if (xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4) {
             if (xenXMConfigSetInt(conf, "hap",
                                   (def->features[VIR_DOMAIN_FEATURE_HAP] ==
-                                   VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+                                   VIR_DOMAIN_ON_OFF_ENABLED) ? 1 : 0) < 0)
                 goto cleanup;
 
             if (xenXMConfigSetInt(conf, "viridian",
                                   (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
-                                   VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+                                   VIR_DOMAIN_ON_OFF_ENABLED) ? 1 : 0) < 0)
                 goto cleanup;
         }
 
-- 
1.8.5.5

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