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(a)redhat.com>
---
src/bhyve/bhyve_capabilities.c | 4 +---
src/conf/domain_capabilities.c | 14 ++++++++++++++
src/conf/domain_capabilities.h | 2 ++
src/libvirt_private.syms | 1 +
src/libxl/libxl_capabilities.c | 5 ++---
5 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index c04a475375..f80cf7be62 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -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;
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 8d0a0c121c..39acad00f1 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -316,6 +316,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,
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 6b27eac11f..9baaea8f60 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -226,6 +226,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,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4d0d03c580..1432f1697a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -202,6 +202,7 @@ virDomainCapsCPUUsableTypeToString;
virDomainCapsDeviceDefValidate;
virDomainCapsEnumClear;
virDomainCapsEnumSet;
+virDomainCapsFeaturesInitUnsupported;
virDomainCapsFormat;
virDomainCapsNew;
virSEVCapabilitiesFree;
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index fe792e9a82..55f6b490ec 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -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;
--
2.23.0