提交 3227e17d 编写于 作者: J Ján Tomko

Introduce virTristateSwitch enum

For the values "default", "on", "off"

Replaces
virDeviceAddressPCIMulti
virDomainFeatureState
virDomainIoEventFd
virDomainVirtioEventIdx
virDomainDiskCopyOnRead
virDomainMemDump
virDomainPCIRombarMode
virDomainGraphicsSpicePlaybackCompression
上级 bb018ce6
......@@ -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,
......
此差异已折叠。
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册