domcaps: Add function for initializing domain caps as unsupported

For future extensions of the domain caps it's useful to have a single
point that initializes all capabilities as unsupported by a driver. The
driver then can enable specific ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-11-13 16:10:45 +01:00
parent f2316d8d26
commit 5751a0b6b1
5 changed files with 20 additions and 6 deletions

View File

@ -116,9 +116,7 @@ virBhyveDomainCapsFill(virDomainCapsPtr caps,
}
caps->hostdev.supported = VIR_TRISTATE_BOOL_NO;
caps->iothreads = VIR_TRISTATE_BOOL_NO;
caps->vmcoreinfo = VIR_TRISTATE_BOOL_NO;
caps->genid = VIR_TRISTATE_BOOL_NO;
virDomainCapsFeaturesInitUnsupported(caps);
caps->gic.supported = VIR_TRISTATE_BOOL_NO;
return 0;

View File

@ -309,6 +309,20 @@ virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum)
}
/**
* @caps: domain caps
*
* Initializes all features in 'caps' as unsupported.
*/
void
virDomainCapsFeaturesInitUnsupported(virDomainCapsPtr caps)
{
caps->iothreads = VIR_TRISTATE_BOOL_NO;
caps->vmcoreinfo = VIR_TRISTATE_BOOL_NO;
caps->genid = VIR_TRISTATE_BOOL_NO;
}
static int
virDomainCapsEnumFormat(virBufferPtr buf,
const virDomainCapsEnum *capsEnum,

View File

@ -225,6 +225,8 @@ 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,

View File

@ -202,6 +202,7 @@ virDomainCapsCPUUsableTypeToString;
virDomainCapsDeviceDefValidate;
virDomainCapsEnumClear;
virDomainCapsEnumSet;
virDomainCapsFeaturesInitUnsupported;
virDomainCapsFormat;
virDomainCapsNew;
virSEVCapabilitiesFree;

View File

@ -764,9 +764,8 @@ libxlMakeDomainCapabilities(virDomainCapsPtr domCaps,
libxlMakeDomainDeviceHostdevCaps(hostdev) < 0)
return -1;
domCaps->iothreads = VIR_TRISTATE_BOOL_NO;
domCaps->vmcoreinfo = VIR_TRISTATE_BOOL_NO;
domCaps->genid = VIR_TRISTATE_BOOL_NO;
virDomainCapsFeaturesInitUnsupported(domCaps);
domCaps->gic.supported = VIR_TRISTATE_BOOL_NO;
return 0;