For the values "default", "on", "off"
Replaces
virDeviceAddressPCIMulti
virDomainFeatureState
virDomainIoEventFd
virDomainVirtioEventIdx
virDomainDiskCopyOnRead
virDomainMemDump
virDomainPCIRombarMode
virDomainGraphicsSpicePlaybackCompression
---
src/conf/device_conf.c | 8 +--
src/conf/device_conf.h | 10 ----
src/conf/domain_conf.c | 145 ++++++++++++++++++-----------------------------
src/conf/domain_conf.h | 73 ++----------------------
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 | 68 +++++++++++-----------
src/qemu/qemu_process.c | 2 +-
src/util/virutil.c | 6 ++
src/util/virutil.h | 10 ++++
src/vbox/vbox_tmpl.c | 22 +++----
src/xenxs/xen_sxpr.c | 20 +++----
src/xenxs/xen_xm.c | 20 +++----
15 files changed, 150 insertions(+), 264 deletions(-)
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 6412d24..b3b04e1 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -32,12 +32,6 @@
#define VIR_FROM_THIS VIR_FROM_DEVICE
-VIR_ENUM_IMPL(virDeviceAddressPCIMulti,
- VIR_DEVICE_ADDRESS_PCI_MULTI_LAST,
- "default",
- "on",
- "off")
-
VIR_ENUM_IMPL(virInterfaceState,
VIR_INTERFACE_STATE_LAST,
"" /* value of zero means no state */,
@@ -98,7 +92,7 @@ virDevicePCIAddressParseXML(xmlNodePtr node,
}
if (multi &&
- ((addr->multi = virDeviceAddressPCIMultiTypeFromString(multi)) <= 0)) {
+ ((addr->multi = virTristateSwitchTypeFromString(multi)) <= 0)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unknown value '%s' for <address>
'multifunction' attribute"),
multi);
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 0c65a5a..f067a35 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -33,16 +33,6 @@
# include "virbuffer.h"
typedef enum {
- VIR_DEVICE_ADDRESS_PCI_MULTI_DEFAULT = 0,
- VIR_DEVICE_ADDRESS_PCI_MULTI_ON,
- VIR_DEVICE_ADDRESS_PCI_MULTI_OFF,
-
- VIR_DEVICE_ADDRESS_PCI_MULTI_LAST
-} virDeviceAddressPCIMulti;
-
-VIR_ENUM_DECL(virDeviceAddressPCIMulti)
-
-typedef enum {
VIR_INTERFACE_STATE_UNKNOWN = 1,
VIR_INTERFACE_STATE_NOT_PRESENT,
VIR_INTERFACE_STATE_DOWN,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e374604..b1e18a4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -144,11 +144,6 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
"hyperv",
"pvspinlock")
-VIR_ENUM_IMPL(virDomainFeatureState, VIR_DOMAIN_FEATURE_STATE_LAST,
- "default",
- "on",
- "off")
-
VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
"relaxed",
"vapic",
@@ -257,21 +252,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",
@@ -434,11 +414,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",
@@ -547,12 +522,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",
@@ -587,12 +556,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")
@@ -2537,7 +2500,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_TRISTATE_SWITCH_ABSENT) ||
info->romfile)
return true;
if (info->bootIndex)
@@ -3144,7 +3107,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
virBufferAddLit(buf, "<rom");
if (info->rombar) {
- const char *rombar = virDomainPCIRombarModeTypeToString(info->rombar);
+ const char *rombar = virTristateSwitchTypeToString(info->rombar);
if (!rombar) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -3176,7 +3139,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
info->addr.pci.function);
if (info->addr.pci.multi) {
virBufferAsprintf(buf, " multifunction='%s'",
-
virDeviceAddressPCIMultiTypeToString(info->addr.pci.multi));
+ virTristateSwitchTypeToString(info->addr.pci.multi));
}
break;
@@ -3661,7 +3624,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
if (rom) {
char *rombar = virXMLPropString(rom, "bar");
if (rombar &&
- ((info->rombar = virDomainPCIRombarModeTypeFromString(rombar)) <= 0))
{
+ ((info->rombar = virTristateSwitchTypeFromString(rombar)) <= 0)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown rom bar value '%s'"), rombar);
VIR_FREE(rombar);
@@ -5728,7 +5691,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (removable) {
- if ((def->removable = virDomainFeatureStateTypeFromString(removable)) < 0)
{
+ if ((def->removable = virTristateSwitchTypeFromString(removable)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk removable status '%s'"),
removable);
goto error;
@@ -5741,7 +5704,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
} else {
if (def->bus == VIR_DOMAIN_DISK_BUS_USB) {
- def->removable = VIR_DOMAIN_FEATURE_STATE_DEFAULT;
+ def->removable = VIR_TRISTATE_SWITCH_ABSENT;
}
}
@@ -5801,7 +5764,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
- if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
+ if ((val = virTristateSwitchTypeFromString(ioeventfd)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk ioeventfd mode '%s'"),
ioeventfd);
@@ -5819,7 +5782,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
int idx;
- if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
+ if ((idx = virTristateSwitchTypeFromString(event_idx)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk event_idx mode '%s'"),
event_idx);
@@ -5830,7 +5793,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (copy_on_read) {
int cor;
- if ((cor = virDomainDiskCopyOnReadTypeFromString(copy_on_read)) <= 0) {
+ if ((cor = virTristateSwitchTypeFromString(copy_on_read)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk copy_on_read mode '%s'"),
copy_on_read);
@@ -6972,7 +6935,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (ioeventfd) {
int val;
- if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
+ if ((val = virTristateSwitchTypeFromString(ioeventfd)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown interface ioeventfd mode
'%s'"),
ioeventfd);
@@ -6982,7 +6945,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (event_idx) {
int idx;
- if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
+ if ((idx = virTristateSwitchTypeFromString(event_idx)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown interface event_idx mode
'%s'"),
event_idx);
@@ -8726,7 +8689,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
}
if ((compressionVal =
-
virDomainGraphicsSpicePlaybackCompressionTypeFromString(compression)) <= 0) {
+ virTristateSwitchTypeFromString(compression)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unknown spice playback
compression"));
VIR_FREE(compression);
@@ -11351,7 +11314,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 = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Invalid memory core dump attribute value
'%s'"), tmp);
goto error;
@@ -11820,7 +11783,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 = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown value for attribute eoi:
'%s'"),
tmp);
@@ -11836,14 +11799,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_TRISTATE_SWITCH_ON;
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] = virTristateSwitchTypeFromString(tmp)) == -1)
{
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown state attribute '%s' of
feature '%s'"),
tmp, virDomainFeatureTypeToString(val));
@@ -11851,7 +11814,7 @@ virDomainDefParseXML(xmlDocPtr xml,
}
VIR_FREE(tmp);
} else {
- def->features[val] = VIR_DOMAIN_FEATURE_STATE_ON;
+ def->features[val] = VIR_TRISTATE_SWITCH_ON;
}
ctxt->node = node;
break;
@@ -11862,7 +11825,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_TRISTATE_SWITCH_ON) {
int feature;
int value;
node = ctxt->node;
@@ -11891,7 +11854,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
}
- if ((value = virDomainFeatureStateTypeFromString(tmp)) < 0) {
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid value of state argument "
"for HyperV Enlightenment feature
'%s'"),
@@ -11912,7 +11875,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
}
- if ((value = virDomainFeatureStateTypeFromString(tmp)) < 0) {
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid value of state argument "
"for HyperV Enlightenment feature
'%s'"),
@@ -11921,7 +11884,7 @@ virDomainDefParseXML(xmlDocPtr xml,
}
VIR_FREE(tmp);
- if (value == VIR_DOMAIN_FEATURE_STATE_ON) {
+ if (value == VIR_TRISTATE_SWITCH_ON) {
if (virXPathUInt("string(./@retries)", ctxt,
&def->hyperv_spinlocks) < 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -13912,8 +13875,8 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
_("State of feature '%s' differs: "
"source: '%s', destination:
'%s'"),
virDomainFeatureTypeToString(i),
- virDomainFeatureStateTypeToString(src->features[i]),
- virDomainFeatureStateTypeToString(dst->features[i]));
+ virTristateSwitchTypeToString(src->features[i]),
+ virTristateSwitchTypeToString(dst->features[i]));
return false;
}
}
@@ -13923,13 +13886,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));
+ virTristateSwitchTypeToString(src->apic_eoi),
+ virTristateSwitchTypeToString(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_TRISTATE_SWITCH_ON) {
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
switch ((virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
@@ -13940,8 +13903,8 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
"feature '%s' differs: "
"source: '%s', destination:
'%s'"),
virDomainHypervTypeToString(i),
-
virDomainFeatureStateTypeToString(src->hyperv_features[i]),
-
virDomainFeatureStateTypeToString(dst->hyperv_features[i]));
+
virTristateSwitchTypeToString(src->hyperv_features[i]),
+
virTristateSwitchTypeToString(dst->hyperv_features[i]));
return false;
}
@@ -15045,9 +15008,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 = virTristateSwitchTypeToString(def->ioeventfd);
+ const char *event_idx = virTristateSwitchTypeToString(def->event_idx);
+ const char *copy_on_read = virTristateSwitchTypeToString(def->copy_on_read);
const char *sgio = virDomainDeviceSGIOTypeToString(def->sgio);
const char *discard = virDomainDiskDiscardTypeToString(def->discard);
@@ -15188,9 +15151,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_TRISTATE_SWITCH_ABSENT) {
virBufferAsprintf(buf, " removable='%s'",
- virDomainFeatureStateTypeToString(def->removable));
+ virTristateSwitchTypeToString(def->removable));
}
virBufferAddLit(buf, "/>\n");
@@ -15872,11 +15835,11 @@ virDomainNetDefFormat(virBufferPtr buf,
}
if (def->driver.virtio.ioeventfd) {
virBufferAsprintf(buf, " ioeventfd='%s'",
-
virDomainIoEventFdTypeToString(def->driver.virtio.ioeventfd));
+
virTristateSwitchTypeToString(def->driver.virtio.ioeventfd));
}
if (def->driver.virtio.event_idx) {
virBufferAsprintf(buf, " event_idx='%s'",
-
virDomainVirtioEventIdxTypeToString(def->driver.virtio.event_idx));
+
virTristateSwitchTypeToString(def->driver.virtio.event_idx));
}
if (def->driver.virtio.queues)
virBufferAsprintf(buf, " queues='%u'",
def->driver.virtio.queues);
@@ -16912,7 +16875,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));
+
virTristateSwitchTypeToString(def->data.spice.playback));
if (def->data.spice.streaming)
virBufferAsprintf(buf, "<streaming mode='%s'/>\n",
virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
@@ -17232,7 +17195,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virBufferAddLit(buf, "<memory");
if (def->mem.dump_core)
virBufferAsprintf(buf, " dumpCore='%s'",
- virDomainMemDumpTypeToString(def->mem.dump_core));
+ virTristateSwitchTypeToString(def->mem.dump_core));
virBufferAsprintf(buf, " unit='KiB'>%llu</memory>\n",
def->mem.max_balloon);
@@ -17560,7 +17523,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_TRISTATE_SWITCH_ABSENT)
break;
}
@@ -17584,16 +17547,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 ((virTristateSwitch) def->features[i]) {
+ case VIR_TRISTATE_SWITCH_ABSENT:
break;
- case VIR_DOMAIN_FEATURE_STATE_ON:
+ case VIR_TRISTATE_SWITCH_ON:
virBufferAsprintf(buf, "<%s/>\n", name);
break;
- case VIR_DOMAIN_FEATURE_STATE_LAST:
- case VIR_DOMAIN_FEATURE_STATE_OFF:
+ case VIR_TRISTATE_SWITCH_LAST:
+ case VIR_TRISTATE_SWITCH_OFF:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected state of feature '%s'"),
name);
@@ -17604,16 +17567,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 ((virTristateSwitch) def->features[i]) {
+ case VIR_TRISTATE_SWITCH_LAST:
+ case VIR_TRISTATE_SWITCH_ABSENT:
break;
- case VIR_DOMAIN_FEATURE_STATE_ON:
+ case VIR_TRISTATE_SWITCH_ON:
virBufferAsprintf(buf, "<%s state='on'/>\n",
name);
break;
- case VIR_DOMAIN_FEATURE_STATE_OFF:
+ case VIR_TRISTATE_SWITCH_OFF:
virBufferAsprintf(buf, "<%s state='off'/>\n",
name);
break;
}
@@ -17621,18 +17584,18 @@ virDomainDefFormatInternal(virDomainDefPtr def,
break;
case VIR_DOMAIN_FEATURE_APIC:
- if (def->features[i] == VIR_DOMAIN_FEATURE_STATE_ON) {
+ if (def->features[i] == VIR_TRISTATE_SWITCH_ON) {
virBufferAddLit(buf, "<apic");
if (def->apic_eoi) {
virBufferAsprintf(buf, " eoi='%s'",
-
virDomainFeatureStateTypeToString(def->apic_eoi));
+
virTristateSwitchTypeToString(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_TRISTATE_SWITCH_ON)
break;
virBufferAddLit(buf, "<hyperv>\n");
@@ -17644,7 +17607,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (def->hyperv_features[j])
virBufferAsprintf(buf, "<%s
state='%s'/>\n",
virDomainHypervTypeToString(j),
- virDomainFeatureStateTypeToString(
+ virTristateSwitchTypeToString(
def->hyperv_features[j]));
break;
@@ -17653,9 +17616,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
break;
virBufferAsprintf(buf, "<spinlocks
state='%s'",
- virDomainFeatureStateTypeToString(
+ virTristateSwitchTypeToString(
def->hyperv_features[j]));
- if (def->hyperv_features[j] == VIR_DOMAIN_FEATURE_STATE_ON)
+ if (def->hyperv_features[j] == VIR_TRISTATE_SWITCH_ON)
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 8d2c546..3e364d3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -218,14 +218,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 +527,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 +572,7 @@ struct _virDomainDiskDef {
int bus; /* enum virDomainDiskBus */
char *dst;
int tray_status; /* enum virDomainDiskTray */
- int removable; /* enum virDomainFeatureState */
+ int removable; /* enum virTristateSwitch */
virStorageSourcePtr mirror;
bool mirroring;
@@ -865,8 +833,8 @@ struct _virDomainNetDef {
struct {
virDomainNetBackendType name; /* which driver backend to use */
virDomainNetVirtioTxModeType txmode;
- virDomainIoEventFd ioeventfd;
- virDomainVirtioEventIdx event_idx;
+ virTristateSwitch ioeventfd;
+ virTristateSwitch event_idx;
unsigned int queues; /* Multiqueue virtio-net */
} virtio;
} driver;
@@ -1312,14 +1280,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 +1408,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,
@@ -1509,14 +1461,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,
@@ -1873,9 +1817,9 @@ struct _virDomainDef {
virDomainOSDef os;
char *emulator;
int features[VIR_DOMAIN_FEATURE_LAST];
- /* enum virDomainFeatureState */
+ /* enum virTristateSwitch */
int apic_eoi;
- /* These options are of type virDomainFeatureState */
+ /* These options are of type virTristateSwitch */
int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
unsigned int hyperv_spinlocks;
@@ -2493,7 +2437,6 @@ VIR_ENUM_DECL(virDomainTaint)
VIR_ENUM_DECL(virDomainVirt)
VIR_ENUM_DECL(virDomainBoot)
VIR_ENUM_DECL(virDomainFeature)
-VIR_ENUM_DECL(virDomainFeatureState)
VIR_ENUM_DECL(virDomainLifecycle)
VIR_ENUM_DECL(virDomainLifecycleCrash)
VIR_ENUM_DECL(virDomainDevice)
@@ -2507,9 +2450,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)
@@ -2532,7 +2472,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)
@@ -2541,7 +2480,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)
@@ -2554,7 +2492,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 5e73f51..f0e54ea 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -77,8 +77,6 @@ virCPUModeTypeToString;
# conf/device_conf.h
-virDeviceAddressPCIMultiTypeFromString;
-virDeviceAddressPCIMultiTypeToString;
virDevicePCIAddressEqual;
virDevicePCIAddressFormat;
virDevicePCIAddressIsValid;
@@ -217,8 +215,6 @@ virDomainDeviceTypeToString;
virDomainDiskBusTypeToString;
virDomainDiskCacheTypeFromString;
virDomainDiskCacheTypeToString;
-virDomainDiskCopyOnReadTypeFromString;
-virDomainDiskCopyOnReadTypeToString;
virDomainDiskDefAssignAddress;
virDomainDiskDefForeachPath;
virDomainDiskDefFree;
@@ -249,8 +245,6 @@ virDomainDiskSetType;
virDomainDiskSourceIsBlockType;
virDomainEmulatorPinAdd;
virDomainEmulatorPinDel;
-virDomainFeatureStateTypeFromString;
-virDomainFeatureStateTypeToString;
virDomainFSDefFree;
virDomainFSIndexByName;
virDomainFSInsert;
@@ -279,8 +273,6 @@ virDomainGraphicsSpiceJpegCompressionTypeFromString;
virDomainGraphicsSpiceJpegCompressionTypeToString;
virDomainGraphicsSpiceMouseModeTypeFromString;
virDomainGraphicsSpiceMouseModeTypeToString;
-virDomainGraphicsSpicePlaybackCompressionTypeFromString;
-virDomainGraphicsSpicePlaybackCompressionTypeToString;
virDomainGraphicsSpiceStreamingModeTypeFromString;
virDomainGraphicsSpiceStreamingModeTypeToString;
virDomainGraphicsSpiceZlibCompressionTypeFromString;
@@ -305,8 +297,6 @@ virDomainHubTypeToString;
virDomainHypervTypeFromString;
virDomainHypervTypeToString;
virDomainInputDefFree;
-virDomainIoEventFdTypeFromString;
-virDomainIoEventFdTypeToString;
virDomainLeaseDefFree;
virDomainLeaseIndex;
virDomainLeaseInsert;
@@ -323,8 +313,6 @@ virDomainLockFailureTypeFromString;
virDomainLockFailureTypeToString;
virDomainMemballoonModelTypeFromString;
virDomainMemballoonModelTypeToString;
-virDomainMemDumpTypeFromString;
-virDomainMemDumpTypeToString;
virDomainNetDefFormat;
virDomainNetDefFree;
virDomainNetFind;
@@ -369,8 +357,6 @@ virDomainObjSetState;
virDomainObjTaint;
virDomainPausedReasonTypeFromString;
virDomainPausedReasonTypeToString;
-virDomainPCIRombarModeTypeFromString;
-virDomainPCIRombarModeTypeToString;
virDomainPMSuspendedReasonTypeFromString;
virDomainPMSuspendedReasonTypeToString;
virDomainRedirdevBusTypeFromString;
@@ -430,8 +416,6 @@ virDomainVideoDefaultType;
virDomainVideoDefFree;
virDomainVideoTypeFromString;
virDomainVideoTypeToString;
-virDomainVirtioEventIdxTypeFromString;
-virDomainVirtioEventIdxTypeToString;
virDomainVirtTypeFromString;
virDomainVirtTypeToString;
virDomainWatchdogActionTypeFromString;
@@ -2132,6 +2116,8 @@ virSetUIDGIDWithCaps;
virStrIsPrint;
virTristateBoolTypeFromString;
virTristateBoolTypeToString;
+virTristateSwitchTypeFromString;
+virTristateSwitchTypeToString;
virUpdateSelfLastChanged;
virValidateWWN;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index a39dc4f..02cb79e 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_TRISTATE_SWITCH_ON);
libxl_defbool_set(&b_info->u.hvm.apic,
def->features[VIR_DOMAIN_FEATURE_APIC] ==
- VIR_DOMAIN_FEATURE_STATE_ON);
+ VIR_TRISTATE_SWITCH_ON);
libxl_defbool_set(&b_info->u.hvm.acpi,
def->features[VIR_DOMAIN_FEATURE_ACPI] ==
- VIR_DOMAIN_FEATURE_STATE_ON);
+ VIR_TRISTATE_SWITCH_ON);
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..3e01f17 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_TRISTATE_SWITCH_ON,
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_TRISTATE_SWITCH_ON)
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..d5c641f 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_TRISTATE_SWITCH_ON;
}
return 0;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bde3af1..352a1a2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1434,7 +1434,7 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
}
entireSlot = (addr->function == 0 &&
- addr->multi != VIR_DEVICE_ADDRESS_PCI_MULTI_ON);
+ addr->multi != VIR_TRISTATE_SWITCH_ON);
if (virDomainPCIAddressReserveAddr(addrs, addr, flags,
entireSlot, true) < 0)
@@ -2141,7 +2141,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
break;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
addr.function = 0;
- addr.multi = VIR_DEVICE_ADDRESS_PCI_MULTI_ON;
+ addr.multi = VIR_TRISTATE_SWITCH_ON;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
addr.function = 1;
@@ -2346,7 +2346,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
"are supported with this QEMU binary"));
goto cleanup;
}
- if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_ON) {
+ if (info->addr.pci.multi == VIR_TRISTATE_SWITCH_ON) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("'multifunction=on' is not supported with
"
"this QEMU binary"));
@@ -2378,9 +2378,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
virBufferAddLit(buf, ",bus=pci");
}
}
- if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_ON)
+ if (info->addr.pci.multi == VIR_TRISTATE_SWITCH_ON)
virBufferAddLit(buf, ",multifunction=on");
- else if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_OFF)
+ else if (info->addr.pci.multi == VIR_TRISTATE_SWITCH_OFF)
virBufferAddLit(buf, ",multifunction=off");
virBufferAsprintf(buf, ",addr=0x%x", info->addr.pci.slot);
if (info->addr.pci.function != 0)
@@ -2424,10 +2424,10 @@ qemuBuildRomStr(virBufferPtr buf,
}
switch (info->rombar) {
- case VIR_DOMAIN_PCI_ROMBAR_OFF:
+ case VIR_TRISTATE_SWITCH_OFF:
virBufferAddLit(buf, ",rombar=0");
break;
- case VIR_DOMAIN_PCI_ROMBAR_ON:
+ case VIR_TRISTATE_SWITCH_ON:
virBufferAddLit(buf, ",rombar=1");
break;
default:
@@ -2441,12 +2441,12 @@ qemuBuildRomStr(virBufferPtr buf,
static int
qemuBuildIoEventFdStr(virBufferPtr buf,
- virDomainIoEventFd use,
+ virTristateSwitch use,
virQEMUCapsPtr qemuCaps)
{
if (use && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOEVENTFD))
virBufferAsprintf(buf, ",ioeventfd=%s",
- virDomainIoEventFdTypeToString(use));
+ virTristateSwitchTypeToString(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));
+ virTristateSwitchTypeToString(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));
+ virTristateSwitchTypeToString(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_TRISTATE_SWITCH_ON)
virBufferAddLit(&opt, ",removable=on");
else
virBufferAddLit(&opt, ",removable=off");
} else {
- if (disk->removable != VIR_DOMAIN_FEATURE_STATE_DEFAULT) {
+ if (disk->removable != VIR_TRISTATE_SWITCH_ABSENT) {
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));
+
virTristateSwitchTypeToString(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_TRISTATE_SWITCH_ON)
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_TRISTATE_SWITCH_ON)
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_TRISTATE_SWITCH_ON) {
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_TRISTATE_SWITCH_ON)
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_TRISTATE_SWITCH_ON)
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));
+ virTristateSwitchTypeToString(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));
+
virTristateSwitchTypeToString(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_TRISTATE_SWITCH_ON)
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_TRISTATE_SWITCH_ON;
else
- dom->apic_eoi = VIR_DOMAIN_FEATURE_STATE_OFF;
+ dom->apic_eoi = VIR_TRISTATE_SWITCH_OFF;
} 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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
break;
case VIR_DOMAIN_HYPERV_SPINLOCKS:
- dom->hyperv_features[f] = VIR_DOMAIN_FEATURE_STATE_ON;
+ dom->hyperv_features[f] = VIR_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
}
}
@@ -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_TRISTATE_SWITCH_ON;
#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_TRISTATE_SWITCH_ABSENT;
} 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 = virTristateSwitchTypeFromString(param);
if (def->mem.dump_core <= 0)
- def->mem.dump_core = VIR_DOMAIN_MEM_DUMP_DEFAULT;
+ def->mem.dump_core = VIR_TRISTATE_SWITCH_ABSENT;
} 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_TRISTATE_SWITCH_ON;
}
}
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_TRISTATE_SWITCH_ABSENT;
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..bc22a40 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_TRISTATE_SWITCH_ON) {
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/util/virutil.c b/src/util/virutil.c
index 305c40c..4eb4682 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -97,6 +97,12 @@ VIR_ENUM_IMPL(virTristateBool, VIR_TRISTATE_BOOL_LAST,
"yes",
"no")
+VIR_ENUM_IMPL(virTristateSwitch, VIR_TRISTATE_SWITCH_LAST,
+ "default",
+ "on",
+ "off")
+
+
#ifndef WIN32
int virSetInherit(int fd, bool inherit)
diff --git a/src/util/virutil.h b/src/util/virutil.h
index a06b9a5..504e13e 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -212,6 +212,16 @@ typedef enum {
VIR_TRISTATE_BOOL_LAST
} virTristateBool;
+typedef enum {
+ VIR_TRISTATE_SWITCH_ABSENT = 0,
+ VIR_TRISTATE_SWITCH_ON,
+ VIR_TRISTATE_SWITCH_OFF,
+
+ VIR_TRISTATE_SWITCH_LAST
+} virTristateSwitch;
+
+
VIR_ENUM_DECL(virTristateBool)
+VIR_ENUM_DECL(virTristateSwitch)
#endif /* __VIR_UTIL_H__ */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index fa5020f..84ab501 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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON);
#elif VBOX_API_VERSION == 3001000
rc = machine->vtbl->SetCpuProperty(machine, CpuPropertyType_PAE,
def->features[VIR_DOMAIN_FEATURE_PAE] ==
- VIR_DOMAIN_FEATURE_STATE_ON);
+ VIR_TRISTATE_SWITCH_ON);
#elif VBOX_API_VERSION >= 3002000
rc = machine->vtbl->SetCPUProperty(machine, CPUPropertyType_PAE,
def->features[VIR_DOMAIN_FEATURE_PAE] ==
- VIR_DOMAIN_FEATURE_STATE_ON);
+ VIR_TRISTATE_SWITCH_ON);
#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_TRISTATE_SWITCH_ON)
? _("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_TRISTATE_SWITCH_ON);
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_TRISTATE_SWITCH_ON)
? _("Enabled") : _("Disabled"),
(unsigned)rc);
}
rc = bios->vtbl->SetIOAPICEnabled(bios,
def->features[VIR_DOMAIN_FEATURE_APIC] ==
- VIR_DOMAIN_FEATURE_STATE_ON);
+ VIR_TRISTATE_SWITCH_ON);
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_TRISTATE_SWITCH_ON)
? _("Enabled") : _("Disabled"),
(unsigned)rc);
}
VBOX_RELEASE(bios);
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 9e59804..007353c 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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
}
/* 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_TRISTATE_SWITCH_ON)
virBufferAddLit(&buf, "(acpi 1)");
- if (def->features[VIR_DOMAIN_FEATURE_APIC] ==
VIR_DOMAIN_FEATURE_STATE_ON)
+ if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_TRISTATE_SWITCH_ON)
virBufferAddLit(&buf, "(apic 1)");
- if (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON)
+ if (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_TRISTATE_SWITCH_ON)
virBufferAddLit(&buf, "(pae 1)");
- if (def->features[VIR_DOMAIN_FEATURE_HAP] == VIR_DOMAIN_FEATURE_STATE_ON)
+ if (def->features[VIR_DOMAIN_FEATURE_HAP] == VIR_TRISTATE_SWITCH_ON)
virBufferAddLit(&buf, "(hap 1)");
- if (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
VIR_DOMAIN_FEATURE_STATE_ON)
+ if (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] == VIR_TRISTATE_SWITCH_ON)
virBufferAddLit(&buf, "(viridian 1)");
virBufferAddLit(&buf, "(usb 1)");
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 25a042d..470bb78 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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON;
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_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
goto cleanup;
if (xenXMConfigSetInt(conf, "acpi",
(def->features[VIR_DOMAIN_FEATURE_ACPI] ==
- VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+ VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
goto cleanup;
if (xenXMConfigSetInt(conf, "apic",
(def->features[VIR_DOMAIN_FEATURE_APIC] ==
- VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+ VIR_TRISTATE_SWITCH_ON) ? 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_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
goto cleanup;
if (xenXMConfigSetInt(conf, "viridian",
(def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
- VIR_DOMAIN_FEATURE_STATE_ON) ? 1 : 0) < 0)
+ VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
goto cleanup;
}
--
1.8.5.5