mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
Introduce virTristateSwitch enum
For the values "default", "on", "off" Replaces virDeviceAddressPCIMulti virDomainFeatureState virDomainIoEventFd virDomainVirtioEventIdx virDomainDiskCopyOnRead virDomainMemDump virDomainPCIRombarMode virDomainGraphicsSpicePlaybackCompression
This commit is contained in:
parent
bb018ce6c8
commit
3227e17d82
@ -212,9 +212,9 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver ATTRIBUTE_UNUSED,
|
||||
VIR_DIV_UP(def->mem.max_balloon, 1024));
|
||||
|
||||
/* Options */
|
||||
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, "-A"); /* Create an ACPI table */
|
||||
if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_FEATURE_STATE_ON)
|
||||
if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_TRISTATE_SWITCH_ON)
|
||||
virCommandAddArg(cmd, "-I"); /* Present ioapic to the guest */
|
||||
|
||||
/* Clarification about -H and -P flags from Peter Grehan:
|
||||
|
@ -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);
|
||||
|
@ -32,16 +32,6 @@
|
||||
# include "virthread.h"
|
||||
# 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,
|
||||
|
@ -145,11 +145,6 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
|
||||
"pvspinlock",
|
||||
"capabilities")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainFeatureState, VIR_DOMAIN_FEATURE_STATE_LAST,
|
||||
"default",
|
||||
"on",
|
||||
"off")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
|
||||
"default",
|
||||
"allow",
|
||||
@ -302,21 +297,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",
|
||||
@ -480,11 +460,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",
|
||||
@ -593,12 +568,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",
|
||||
@ -633,12 +602,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")
|
||||
|
||||
@ -2589,7 +2552,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)
|
||||
@ -3196,7 +3159,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,
|
||||
@ -3228,7 +3191,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;
|
||||
|
||||
@ -3713,7 +3676,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);
|
||||
@ -5780,7 +5743,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;
|
||||
@ -5793,7 +5756,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5853,7 +5816,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);
|
||||
@ -5871,7 +5834,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);
|
||||
@ -5882,7 +5845,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);
|
||||
@ -7106,7 +7069,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);
|
||||
@ -7116,7 +7079,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);
|
||||
@ -8863,7 +8826,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);
|
||||
@ -11487,7 +11450,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;
|
||||
@ -11867,7 +11830,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);
|
||||
@ -11883,7 +11846,7 @@ 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_CAPABILITIES:
|
||||
@ -11898,7 +11861,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
} else {
|
||||
def->features[val] = VIR_DOMAIN_FEATURE_STATE_DEFAULT;
|
||||
def->features[val] = VIR_TRISTATE_SWITCH_ABSENT;
|
||||
}
|
||||
ctxt->node = node;
|
||||
break;
|
||||
@ -11906,7 +11869,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
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));
|
||||
@ -11914,7 +11877,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;
|
||||
@ -11925,7 +11888,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;
|
||||
@ -11954,7 +11917,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'"),
|
||||
@ -11975,7 +11938,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'"),
|
||||
@ -11984,7 +11947,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",
|
||||
@ -12026,7 +11989,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
ctxt->node = nodes[i];
|
||||
|
||||
if ((tmp = virXPathString("string(./@state)", ctxt))) {
|
||||
if ((def->caps_features[val] = virDomainFeatureStateTypeFromString(tmp)) == -1) {
|
||||
if ((def->caps_features[val] = virTristateSwitchTypeFromString(tmp)) == -1) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown state attribute '%s' of feature capability '%s'"),
|
||||
tmp, virDomainFeatureTypeToString(val));
|
||||
@ -12034,7 +11997,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
} else {
|
||||
def->caps_features[val] = VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
def->caps_features[val] = VIR_TRISTATE_SWITCH_ON;
|
||||
}
|
||||
ctxt->node = node;
|
||||
}
|
||||
@ -13980,8 +13943,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;
|
||||
}
|
||||
}
|
||||
@ -13991,13 +13954,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:
|
||||
@ -14008,8 +13971,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;
|
||||
}
|
||||
|
||||
@ -15113,9 +15076,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);
|
||||
|
||||
@ -15256,9 +15219,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");
|
||||
|
||||
@ -15962,11 +15925,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);
|
||||
@ -17002,7 +16965,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));
|
||||
@ -17251,7 +17214,7 @@ virDomainDefHasCapabilitiesFeatures(virDomainDefPtr def)
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) {
|
||||
if (def->caps_features[i] != VIR_DOMAIN_FEATURE_STATE_DEFAULT)
|
||||
if (def->caps_features[i] != VIR_TRISTATE_SWITCH_ABSENT)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -17335,7 +17298,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);
|
||||
|
||||
@ -17641,7 +17604,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;
|
||||
}
|
||||
|
||||
@ -17665,16 +17628,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);
|
||||
|
||||
@ -17685,16 +17648,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;
|
||||
}
|
||||
@ -17702,18 +17665,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");
|
||||
@ -17725,7 +17688,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
if (def->hyperv_features[j])
|
||||
virBufferAsprintf(buf, "<%s state='%s'/>\n",
|
||||
virDomainHypervTypeToString(j),
|
||||
virDomainFeatureStateTypeToString(
|
||||
virTristateSwitchTypeToString(
|
||||
def->hyperv_features[j]));
|
||||
break;
|
||||
|
||||
@ -17734,9 +17697,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");
|
||||
@ -17759,10 +17722,10 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
virDomainCapabilitiesPolicyTypeToString(def->features[i]));
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
for (j = 0; j < VIR_DOMAIN_CAPS_FEATURE_LAST; j++) {
|
||||
if (def->caps_features[j] != VIR_DOMAIN_FEATURE_STATE_DEFAULT)
|
||||
if (def->caps_features[j] != VIR_TRISTATE_SWITCH_ABSENT)
|
||||
virBufferAsprintf(buf, "<%s state='%s'/>\n",
|
||||
virDomainCapsFeatureTypeToString(j),
|
||||
virDomainFeatureStateTypeToString(
|
||||
virTristateSwitchTypeToString(
|
||||
def->caps_features[j]));
|
||||
}
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
|
@ -224,14 +224,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 {
|
||||
@ -328,7 +320,7 @@ struct _virDomainDeviceInfo {
|
||||
} master;
|
||||
/* rombar and romfile are only used for pci hostdev and network
|
||||
* devices. */
|
||||
int rombar; /* enum virDomainPCIRombarMode */
|
||||
int rombar; /* enum virTristateSwitch */
|
||||
char *romfile;
|
||||
/* bootIndex is only used for disk, network interface, hostdev
|
||||
* and redirdev devices */
|
||||
@ -540,30 +532,6 @@ typedef enum {
|
||||
VIR_DOMAIN_DISK_IO_LAST
|
||||
} 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,
|
||||
@ -610,7 +578,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;
|
||||
@ -637,9 +605,9 @@ struct _virDomainDiskDef {
|
||||
int error_policy; /* enum virDomainDiskErrorPolicy */
|
||||
int rerror_policy; /* enum virDomainDiskErrorPolicy */
|
||||
int iomode; /* enum virDomainDiskIo */
|
||||
int ioeventfd; /* enum virDomainIoEventFd */
|
||||
int event_idx; /* enum virDomainVirtioEventIdx */
|
||||
int copy_on_read; /* enum virDomainDiskCopyOnRead */
|
||||
int ioeventfd; /* enum virTristateSwitch */
|
||||
int event_idx; /* enum virTristateSwitch */
|
||||
int copy_on_read; /* enum virTristateSwitch */
|
||||
int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
|
||||
int startupPolicy; /* enum virDomainStartupPolicy */
|
||||
bool transient;
|
||||
@ -872,8 +840,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;
|
||||
@ -1319,14 +1287,6 @@ typedef enum {
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_LAST
|
||||
} 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,
|
||||
@ -1456,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 +1469,6 @@ typedef enum {
|
||||
VIR_DOMAIN_FEATURE_LAST
|
||||
} 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,
|
||||
@ -1886,7 +1830,7 @@ struct _virDomainDef {
|
||||
bool hugepage_backed;
|
||||
bool nosharepages;
|
||||
bool locked;
|
||||
int dump_core; /* enum virDomainMemDump */
|
||||
int dump_core; /* enum virTristateSwitch */
|
||||
unsigned long long hard_limit; /* in kibibytes */
|
||||
unsigned long long soft_limit; /* in kibibytes */
|
||||
unsigned long long min_guarantee; /* in kibibytes */
|
||||
@ -1928,14 +1872,13 @@ struct _virDomainDef {
|
||||
|
||||
virDomainOSDef os;
|
||||
char *emulator;
|
||||
/* These three options are of type virTristateSwitch */
|
||||
int features[VIR_DOMAIN_FEATURE_LAST];
|
||||
/* enum virDomainFeatureState */
|
||||
int apic_eoi;
|
||||
/* These options are of type virDomainFeatureState */
|
||||
int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
|
||||
unsigned int hyperv_spinlocks;
|
||||
|
||||
/* This options are of type virDomainFeatureState: ON = keep, OFF = drop */
|
||||
/* These options are of type virTristateSwitch: ON = keep, OFF = drop */
|
||||
int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST];
|
||||
|
||||
virDomainClockDef clock;
|
||||
@ -2552,7 +2495,6 @@ VIR_ENUM_DECL(virDomainTaint)
|
||||
VIR_ENUM_DECL(virDomainVirt)
|
||||
VIR_ENUM_DECL(virDomainBoot)
|
||||
VIR_ENUM_DECL(virDomainFeature)
|
||||
VIR_ENUM_DECL(virDomainFeatureState)
|
||||
VIR_ENUM_DECL(virDomainCapabilitiesPolicy)
|
||||
VIR_ENUM_DECL(virDomainCapsFeature)
|
||||
VIR_ENUM_DECL(virDomainLifecycle)
|
||||
@ -2568,9 +2510,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)
|
||||
@ -2593,7 +2532,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)
|
||||
@ -2602,7 +2540,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)
|
||||
@ -2615,7 +2552,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)
|
||||
|
@ -77,8 +77,6 @@ virCPUModeTypeToString;
|
||||
|
||||
|
||||
# conf/device_conf.h
|
||||
virDeviceAddressPCIMultiTypeFromString;
|
||||
virDeviceAddressPCIMultiTypeToString;
|
||||
virDevicePCIAddressEqual;
|
||||
virDevicePCIAddressFormat;
|
||||
virDevicePCIAddressIsValid;
|
||||
@ -220,8 +218,6 @@ virDomainDeviceTypeToString;
|
||||
virDomainDiskBusTypeToString;
|
||||
virDomainDiskCacheTypeFromString;
|
||||
virDomainDiskCacheTypeToString;
|
||||
virDomainDiskCopyOnReadTypeFromString;
|
||||
virDomainDiskCopyOnReadTypeToString;
|
||||
virDomainDiskDefAssignAddress;
|
||||
virDomainDiskDefForeachPath;
|
||||
virDomainDiskDefFree;
|
||||
@ -252,8 +248,6 @@ virDomainDiskSetType;
|
||||
virDomainDiskSourceIsBlockType;
|
||||
virDomainEmulatorPinAdd;
|
||||
virDomainEmulatorPinDel;
|
||||
virDomainFeatureStateTypeFromString;
|
||||
virDomainFeatureStateTypeToString;
|
||||
virDomainFSDefFree;
|
||||
virDomainFSIndexByName;
|
||||
virDomainFSInsert;
|
||||
@ -282,8 +276,6 @@ virDomainGraphicsSpiceJpegCompressionTypeFromString;
|
||||
virDomainGraphicsSpiceJpegCompressionTypeToString;
|
||||
virDomainGraphicsSpiceMouseModeTypeFromString;
|
||||
virDomainGraphicsSpiceMouseModeTypeToString;
|
||||
virDomainGraphicsSpicePlaybackCompressionTypeFromString;
|
||||
virDomainGraphicsSpicePlaybackCompressionTypeToString;
|
||||
virDomainGraphicsSpiceStreamingModeTypeFromString;
|
||||
virDomainGraphicsSpiceStreamingModeTypeToString;
|
||||
virDomainGraphicsSpiceZlibCompressionTypeFromString;
|
||||
@ -308,8 +300,6 @@ virDomainHubTypeToString;
|
||||
virDomainHypervTypeFromString;
|
||||
virDomainHypervTypeToString;
|
||||
virDomainInputDefFree;
|
||||
virDomainIoEventFdTypeFromString;
|
||||
virDomainIoEventFdTypeToString;
|
||||
virDomainLeaseDefFree;
|
||||
virDomainLeaseIndex;
|
||||
virDomainLeaseInsert;
|
||||
@ -326,8 +316,6 @@ virDomainLockFailureTypeFromString;
|
||||
virDomainLockFailureTypeToString;
|
||||
virDomainMemballoonModelTypeFromString;
|
||||
virDomainMemballoonModelTypeToString;
|
||||
virDomainMemDumpTypeFromString;
|
||||
virDomainMemDumpTypeToString;
|
||||
virDomainNetDefFormat;
|
||||
virDomainNetDefFree;
|
||||
virDomainNetFind;
|
||||
@ -372,8 +360,6 @@ virDomainObjSetState;
|
||||
virDomainObjTaint;
|
||||
virDomainPausedReasonTypeFromString;
|
||||
virDomainPausedReasonTypeToString;
|
||||
virDomainPCIRombarModeTypeFromString;
|
||||
virDomainPCIRombarModeTypeToString;
|
||||
virDomainPMSuspendedReasonTypeFromString;
|
||||
virDomainPMSuspendedReasonTypeToString;
|
||||
virDomainRedirdevBusTypeFromString;
|
||||
@ -433,8 +419,6 @@ virDomainVideoDefaultType;
|
||||
virDomainVideoDefFree;
|
||||
virDomainVideoTypeFromString;
|
||||
virDomainVideoTypeToString;
|
||||
virDomainVirtioEventIdxTypeFromString;
|
||||
virDomainVirtioEventIdxTypeToString;
|
||||
virDomainVirtTypeFromString;
|
||||
virDomainVirtTypeToString;
|
||||
virDomainWatchdogActionTypeFromString;
|
||||
@ -2153,6 +2137,8 @@ virSetUIDGIDWithCaps;
|
||||
virStrIsPrint;
|
||||
virTristateBoolTypeFromString;
|
||||
virTristateBoolTypeToString;
|
||||
virTristateSwitchTypeFromString;
|
||||
virTristateSwitchTypeToString;
|
||||
virUpdateSelfLastChanged;
|
||||
virValidateWWN;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -355,7 +355,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
|
||||
goto cleanup;
|
||||
|
||||
/* white list mknod if CAP_MKNOD has to be kept */
|
||||
if (capMknod == VIR_DOMAIN_FEATURE_STATE_ON) {
|
||||
if (capMknod == VIR_TRISTATE_SWITCH_ON) {
|
||||
if (virCgroupAllowAllDevices(cgroup,
|
||||
VIR_CGROUP_DEVICE_MKNOD) < 0)
|
||||
goto cleanup;
|
||||
|
@ -499,7 +499,7 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
|
||||
char *newname = NULL;
|
||||
virDomainNetDefPtr netDef;
|
||||
bool privNet = vmDef->features[VIR_DOMAIN_FEATURE_PRIVNET] ==
|
||||
VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
VIR_TRISTATE_SWITCH_ON;
|
||||
|
||||
for (i = 0; i < nveths; i++) {
|
||||
if (!(netDef = lxcContainerGetNetDef(vmDef, veths[i])))
|
||||
@ -1954,7 +1954,7 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def,
|
||||
switch ((virDomainCapabilitiesPolicy) policy) {
|
||||
|
||||
case VIR_DOMAIN_CAPABILITIES_POLICY_DENY:
|
||||
if (state == VIR_DOMAIN_FEATURE_STATE_ON &&
|
||||
if (state == VIR_TRISTATE_SWITCH_ON &&
|
||||
(ret = capng_update(CAPNG_ADD,
|
||||
CAPNG_EFFECTIVE | CAPNG_PERMITTED |
|
||||
CAPNG_INHERITABLE | CAPNG_BOUNDING_SET,
|
||||
@ -1969,23 +1969,23 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT:
|
||||
switch ((virDomainCapsFeature) i) {
|
||||
case VIR_DOMAIN_CAPS_FEATURE_SYS_BOOT: /* No use of reboot */
|
||||
toDrop = !keepReboot && (state != VIR_DOMAIN_FEATURE_STATE_ON);
|
||||
toDrop = !keepReboot && (state != VIR_TRISTATE_SWITCH_ON);
|
||||
break;
|
||||
case VIR_DOMAIN_CAPS_FEATURE_SYS_MODULE: /* No kernel module loading */
|
||||
case VIR_DOMAIN_CAPS_FEATURE_SYS_TIME: /* No changing the clock */
|
||||
case VIR_DOMAIN_CAPS_FEATURE_MKNOD: /* No creating device nodes */
|
||||
case VIR_DOMAIN_CAPS_FEATURE_AUDIT_CONTROL: /* No messing with auditing status */
|
||||
case VIR_DOMAIN_CAPS_FEATURE_MAC_ADMIN: /* No messing with LSM config */
|
||||
toDrop = (state != VIR_DOMAIN_FEATURE_STATE_ON);
|
||||
toDrop = (state != VIR_TRISTATE_SWITCH_ON);
|
||||
break;
|
||||
default: /* User specified capabilities to drop */
|
||||
toDrop = (state == VIR_DOMAIN_FEATURE_STATE_OFF);
|
||||
toDrop = (state == VIR_TRISTATE_SWITCH_OFF);
|
||||
}
|
||||
/* Fallthrough */
|
||||
|
||||
case VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW:
|
||||
if (policy == VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW)
|
||||
toDrop = state == VIR_DOMAIN_FEATURE_STATE_OFF;
|
||||
toDrop = state == VIR_TRISTATE_SWITCH_OFF;
|
||||
|
||||
if (toDrop && (ret = capng_update(CAPNG_DROP,
|
||||
CAPNG_EFFECTIVE | CAPNG_PERMITTED |
|
||||
@ -2209,7 +2209,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 &&
|
||||
|
@ -564,7 +564,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;
|
||||
@ -867,7 +867,7 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties)
|
||||
for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) {
|
||||
capString = virDomainCapsFeatureTypeToString(i);
|
||||
if (toDrop != NULL && virStringArrayHasString(toDrop, capString))
|
||||
def->caps_features[i] = VIR_DOMAIN_FEATURE_STATE_OFF;
|
||||
def->caps_features[i] = VIR_TRISTATE_SWITCH_OFF;
|
||||
}
|
||||
|
||||
def->features[VIR_DOMAIN_FEATURE_CAPABILITIES] = VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW;
|
||||
|
@ -1439,7 +1439,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)
|
||||
@ -2146,7 +2146,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;
|
||||
@ -2351,7 +2351,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"));
|
||||
@ -2383,9 +2383,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)
|
||||
@ -2429,10 +2429,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:
|
||||
@ -2446,12 +2446,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;
|
||||
}
|
||||
|
||||
@ -3500,7 +3500,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"));
|
||||
@ -3867,7 +3867,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,
|
||||
@ -3926,12 +3926,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"));
|
||||
@ -4376,7 +4376,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) {
|
||||
@ -6120,7 +6120,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 = '-';
|
||||
@ -6133,7 +6133,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 = '-';
|
||||
@ -6144,7 +6144,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;
|
||||
@ -6154,13 +6154,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;
|
||||
@ -6317,7 +6317,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
|
||||
}
|
||||
|
||||
virBufferAsprintf(&buf, ",dump-guest-core=%s",
|
||||
virDomainMemDumpTypeToString(def->mem.dump_core));
|
||||
virTristateSwitchTypeToString(def->mem.dump_core));
|
||||
}
|
||||
|
||||
if (def->mem.nosharepages) {
|
||||
@ -6810,7 +6810,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));
|
||||
@ -7676,7 +7676,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");
|
||||
}
|
||||
|
||||
@ -10480,9 +10480,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)))
|
||||
@ -10512,7 +10512,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,
|
||||
@ -10530,11 +10530,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"));
|
||||
@ -10767,7 +10767,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10780,7 +10780,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]; \
|
||||
@ -11086,7 +11086,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")) {
|
||||
@ -11198,14 +11198,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);
|
||||
@ -11278,7 +11278,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)
|
||||
|
@ -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"));
|
||||
|
@ -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)
|
||||
|
@ -220,6 +220,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__ */
|
||||
|
@ -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);
|
||||
|
@ -1495,15 +1495,15 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
for (i = 0; i < result->size; i++) {
|
||||
if (STREQ(result->contents[i].val, "true")) {
|
||||
if (STREQ(result->contents[i].key, "acpi"))
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
|
||||
else if (STREQ(result->contents[i].key, "apic"))
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_APIC] = VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_APIC] = VIR_TRISTATE_SWITCH_ON;
|
||||
else if (STREQ(result->contents[i].key, "pae"))
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_PAE] = VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_PAE] = VIR_TRISTATE_SWITCH_ON;
|
||||
else if (STREQ(result->contents[i].key, "hap"))
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_HAP] = VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_HAP] = VIR_TRISTATE_SWITCH_ON;
|
||||
else if (STREQ(result->contents[i].key, "viridian"))
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_VIRIDIAN] = VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
defPtr->features[VIR_DOMAIN_FEATURE_VIRIDIAN] = VIR_TRISTATE_SWITCH_ON;
|
||||
}
|
||||
}
|
||||
xen_string_string_map_free(result);
|
||||
|
@ -514,15 +514,15 @@ createVMRecordFromXml(virConnectPtr conn, virDomainDefPtr def,
|
||||
if (def->onCrash)
|
||||
(*record)->actions_after_crash = actionCrashLibvirt2XenapiEnum(def->onCrash);
|
||||
|
||||
if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_DOMAIN_FEATURE_STATE_ON)
|
||||
if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON)
|
||||
allocStringMap(&strings, (char *)"acpi", (char *)"true");
|
||||
if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_DOMAIN_FEATURE_STATE_ON)
|
||||
if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_TRISTATE_SWITCH_ON)
|
||||
allocStringMap(&strings, (char *)"apic", (char *)"true");
|
||||
if (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_DOMAIN_FEATURE_STATE_ON)
|
||||
if (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_TRISTATE_SWITCH_ON)
|
||||
allocStringMap(&strings, (char *)"pae", (char *)"true");
|
||||
if (def->features[VIR_DOMAIN_FEATURE_HAP] == VIR_DOMAIN_FEATURE_STATE_ON)
|
||||
if (def->features[VIR_DOMAIN_FEATURE_HAP] == VIR_TRISTATE_SWITCH_ON)
|
||||
allocStringMap(&strings, (char *)"hap", (char *)"true");
|
||||
if (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] == VIR_DOMAIN_FEATURE_STATE_ON)
|
||||
if (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] == VIR_TRISTATE_SWITCH_ON)
|
||||
allocStringMap(&strings, (char *)"viridian", (char *)"true");
|
||||
if (strings != NULL)
|
||||
(*record)->platform = strings;
|
||||
|
@ -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 */
|
||||
@ -2339,15 +2339,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)");
|
||||
|
@ -414,23 +414,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;
|
||||
@ -1592,28 +1592,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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user