mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
conf: Make tri-state feature options more universal
The apic-eoi feature enum and implementation can be made more universal to allow re-use of the enum for other features.
This commit is contained in:
parent
998dc17da3
commit
88cac66d92
@ -115,7 +115,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
|
||||
"viridian",
|
||||
"privnet")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainApicEoi, VIR_DOMAIN_APIC_EOI_LAST,
|
||||
VIR_ENUM_IMPL(virDomainFeatureState, VIR_DOMAIN_FEATURE_STATE_LAST,
|
||||
"default",
|
||||
"on",
|
||||
"off")
|
||||
@ -9060,7 +9060,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
||||
tmp = virXPathString("string(./features/apic/@eoi)", ctxt);
|
||||
if (tmp) {
|
||||
int eoi;
|
||||
if ((eoi = virDomainApicEoiTypeFromString(tmp)) <= 0) {
|
||||
if ((eoi = virDomainFeatureStateTypeFromString(tmp)) <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown value for attribute eoi: %s"),
|
||||
tmp);
|
||||
@ -13828,7 +13828,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
if (i == VIR_DOMAIN_FEATURE_APIC && def->apic_eoi) {
|
||||
virBufferAsprintf(buf,
|
||||
" eoi='%s'",
|
||||
virDomainApicEoiTypeToString(def->apic_eoi));
|
||||
virDomainFeatureStateTypeToString(def->apic_eoi));
|
||||
}
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
@ -1389,12 +1389,12 @@ enum virDomainFeature {
|
||||
VIR_DOMAIN_FEATURE_LAST
|
||||
};
|
||||
|
||||
enum virDomainApicEoi {
|
||||
VIR_DOMAIN_APIC_EOI_DEFAULT = 0,
|
||||
VIR_DOMAIN_APIC_EOI_ON,
|
||||
VIR_DOMAIN_APIC_EOI_OFF,
|
||||
enum virDomainFeatureState {
|
||||
VIR_DOMAIN_FEATURE_STATE_DEFAULT = 0,
|
||||
VIR_DOMAIN_FEATURE_STATE_ON,
|
||||
VIR_DOMAIN_FEATURE_STATE_OFF,
|
||||
|
||||
VIR_DOMAIN_APIC_EOI_LAST
|
||||
VIR_DOMAIN_FEATURE_STATE_LAST
|
||||
};
|
||||
|
||||
enum virDomainLifecycleAction {
|
||||
@ -1708,7 +1708,7 @@ struct _virDomainDef {
|
||||
virDomainOSDef os;
|
||||
char *emulator;
|
||||
int features;
|
||||
/* enum virDomainApicEoi */
|
||||
/* enum virDomainFeatureState */
|
||||
int apic_eoi;
|
||||
|
||||
virDomainClockDef clock;
|
||||
@ -2173,7 +2173,7 @@ VIR_ENUM_DECL(virDomainVirt)
|
||||
VIR_ENUM_DECL(virDomainBoot)
|
||||
VIR_ENUM_DECL(virDomainBootMenu)
|
||||
VIR_ENUM_DECL(virDomainFeature)
|
||||
VIR_ENUM_DECL(virDomainApicEoi)
|
||||
VIR_ENUM_DECL(virDomainFeatureState)
|
||||
VIR_ENUM_DECL(virDomainLifecycle)
|
||||
VIR_ENUM_DECL(virDomainLifecycleCrash)
|
||||
VIR_ENUM_DECL(virDomainPMState)
|
||||
|
@ -272,8 +272,6 @@ virBlkioDeviceWeightArrayClear;
|
||||
virDiskNameToBusDeviceIndex;
|
||||
virDiskNameToIndex;
|
||||
virDomainActualNetDefFree;
|
||||
virDomainApicEoiTypeFromString;
|
||||
virDomainApicEoiTypeToString;
|
||||
virDomainAssignDef;
|
||||
virDomainBlockedReasonTypeFromString;
|
||||
virDomainBlockedReasonTypeToString;
|
||||
@ -363,6 +361,8 @@ virDomainFSTypeFromString;
|
||||
virDomainFSTypeToString;
|
||||
virDomainFSWrpolicyTypeFromString;
|
||||
virDomainFSWrpolicyTypeToString;
|
||||
virDomainFeatureStateTypeFromString;
|
||||
virDomainFeatureStateTypeToString;
|
||||
virDomainFindByID;
|
||||
virDomainFindByName;
|
||||
virDomainFindByUUID;
|
||||
|
@ -4227,7 +4227,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
|
||||
|
||||
if (def->apic_eoi) {
|
||||
char sign;
|
||||
if (def->apic_eoi == VIR_DOMAIN_APIC_EOI_ON)
|
||||
if (def->apic_eoi == VIR_DOMAIN_FEATURE_STATE_ON)
|
||||
sign = '+';
|
||||
else
|
||||
sign = '-';
|
||||
@ -7761,9 +7761,9 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
|
||||
dom->clock.timers[i]->present = present;
|
||||
} else if (STREQ(feature, "kvm_pv_eoi")) {
|
||||
if (policy == VIR_CPU_FEATURE_REQUIRE)
|
||||
dom->apic_eoi = VIR_DOMAIN_APIC_EOI_ON;
|
||||
dom->apic_eoi = VIR_DOMAIN_FEATURE_STATE_ON;
|
||||
else
|
||||
dom->apic_eoi = VIR_DOMAIN_APIC_EOI_OFF;
|
||||
dom->apic_eoi = VIR_DOMAIN_FEATURE_STATE_OFF;
|
||||
} else {
|
||||
if (!cpu) {
|
||||
if (!(cpu = qemuInitGuestCPU(dom)))
|
||||
|
Loading…
Reference in New Issue
Block a user