mirror of https://gitee.com/openkylin/libvirt.git
domcaps: Remove function initializing domain caps as unsupported
Commit 5751a0b6b1
added a helper function
called virDomainCapsFeaturesInitUnsupported which initialized all domain
capability features as unsupported.
When adding a new feature this would initialize it as unsupported also
for hypervisor drivers which the original author possibly didn't intend
to modify. To prevent accidental wrong value being reported in such case
revert back to initializing individual features in the hypervisor
drivers themselves.
This is not a straight revert as additonal patches modified how we store
the capabilities.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d6064e2759
commit
c78fadb57c
|
@ -116,7 +116,9 @@ virBhyveDomainCapsFill(virDomainCapsPtr caps,
|
|||
}
|
||||
|
||||
caps->hostdev.supported = VIR_TRISTATE_BOOL_NO;
|
||||
virDomainCapsFeaturesInitUnsupported(caps);
|
||||
caps->features[VIR_DOMAIN_CAPS_FEATURE_IOTHREADS] = VIR_TRISTATE_BOOL_NO;
|
||||
caps->features[VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO] = VIR_TRISTATE_BOOL_NO;
|
||||
caps->features[VIR_DOMAIN_CAPS_FEATURE_GENID] = VIR_TRISTATE_BOOL_NO;
|
||||
caps->gic.supported = VIR_TRISTATE_BOOL_NO;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -272,21 +272,6 @@ virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @caps: domain caps
|
||||
*
|
||||
* Initializes all features in 'caps' as unsupported.
|
||||
*/
|
||||
void
|
||||
virDomainCapsFeaturesInitUnsupported(virDomainCapsPtr caps)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++)
|
||||
caps->features[i] = VIR_TRISTATE_BOOL_NO;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainCapsEnumFormat(virBufferPtr buf,
|
||||
const virDomainCapsEnum *capsEnum,
|
||||
|
|
|
@ -227,8 +227,6 @@ int virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
|
|||
unsigned int *values);
|
||||
void virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum);
|
||||
|
||||
void virDomainCapsFeaturesInitUnsupported(virDomainCapsPtr caps);
|
||||
|
||||
char * virDomainCapsFormat(const virDomainCaps *caps);
|
||||
|
||||
int virDomainCapsDeviceDefValidate(const virDomainCaps *caps,
|
||||
|
|
|
@ -200,7 +200,6 @@ virDomainCapsCPUUsableTypeToString;
|
|||
virDomainCapsDeviceDefValidate;
|
||||
virDomainCapsEnumClear;
|
||||
virDomainCapsEnumSet;
|
||||
virDomainCapsFeaturesInitUnsupported;
|
||||
virDomainCapsFormat;
|
||||
virDomainCapsNew;
|
||||
virSEVCapabilitiesFree;
|
||||
|
|
|
@ -764,8 +764,9 @@ libxlMakeDomainCapabilities(virDomainCapsPtr domCaps,
|
|||
libxlMakeDomainDeviceHostdevCaps(hostdev) < 0)
|
||||
return -1;
|
||||
|
||||
virDomainCapsFeaturesInitUnsupported(domCaps);
|
||||
|
||||
domCaps->features[VIR_DOMAIN_CAPS_FEATURE_IOTHREADS] = VIR_TRISTATE_BOOL_NO;
|
||||
domCaps->features[VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO] = VIR_TRISTATE_BOOL_NO;
|
||||
domCaps->features[VIR_DOMAIN_CAPS_FEATURE_GENID] = VIR_TRISTATE_BOOL_NO;
|
||||
domCaps->gic.supported = VIR_TRISTATE_BOOL_NO;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -5447,6 +5447,8 @@ virQEMUCapsFillDomainFeaturesFromQEMUCaps(virQEMUCapsPtr qemuCaps,
|
|||
for (i = 0; i < G_N_ELEMENTS(domCapsTuples); i++) {
|
||||
if (virQEMUCapsGet(qemuCaps, domCapsTuples[i].qemucap))
|
||||
domCaps->features[domCapsTuples[i].domcap] = VIR_TRISTATE_BOOL_YES;
|
||||
else
|
||||
domCaps->features[domCapsTuples[i].domcap] = VIR_TRISTATE_BOOL_NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5735,7 +5737,6 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps,
|
|||
virDomainCapsDeviceVideoPtr video = &domCaps->video;
|
||||
virDomainCapsDeviceRNGPtr rng = &domCaps->rng;
|
||||
|
||||
virDomainCapsFeaturesInitUnsupported(domCaps);
|
||||
virQEMUCapsFillDomainFeaturesFromQEMUCaps(qemuCaps, domCaps);
|
||||
|
||||
domCaps->maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps,
|
||||
|
|
Loading…
Reference in New Issue