Adding availability of s390-pv in domain capabilities and adjust tests.
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
docs/schemas/domaincaps.rng | 9 +++++++++
src/conf/domain_capabilities.c | 1 +
src/conf/domain_capabilities.h | 1 +
src/qemu/qemu_capabilities.c | 16 ++++++++++++++++
tests/domaincapsdata/qemu_2.11.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.12.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_3.0.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_4.0.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 +
tests/domaincapsmock.c | 17 +++++++++++++++++
12 files changed, 51 insertions(+)
diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng
index 69d7824e7c..8b5267f741 100644
--- a/docs/schemas/domaincaps.rng
+++ b/docs/schemas/domaincaps.rng
@@ -257,6 +257,9 @@
<optional>
<ref name="backup"/>
</optional>
+ <optional>
+ <ref name="s390-pv"/>
+ </optional>
<optional>
<ref name="sev"/>
</optional>
@@ -294,6 +297,12 @@
</element>
</define>
+ <define name="s390-pv">
+ <element name="s390-pv">
+ <ref name="supported"/>
+ </element>
+ </define>
+
<define name="sev">
<element name="sev">
<ref name="supported"/>
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 73139d0ec6..22f0963326 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -42,6 +42,7 @@ VIR_ENUM_IMPL(virDomainCapsFeature,
"genid",
"backingStoreInput",
"backup",
+ "s390-pv",
);
static virClass *virDomainCapsClass;
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index a3765832c1..d44acdcd01 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -186,6 +186,7 @@ typedef enum {
VIR_DOMAIN_CAPS_FEATURE_GENID,
VIR_DOMAIN_CAPS_FEATURE_BACKING_STORE_INPUT,
VIR_DOMAIN_CAPS_FEATURE_BACKUP,
+ VIR_DOMAIN_CAPS_FEATURE_S390_PV,
VIR_DOMAIN_CAPS_FEATURE_LAST
} virDomainCapsFeature;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a0f04bb44c..6deeab8a12 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6335,6 +6335,21 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCaps *qemuCaps,
}
+static void
+virQEMUCapsFillDomainFeatureS390PVCaps(virQEMUCaps *qemuCaps,
+ virDomainCaps *domCaps)
+{
+ if (ARCH_IS_S390(qemuCaps->arch)) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT)
&&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST) &&
+ virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps))
+ domCaps->features[VIR_DOMAIN_CAPS_FEATURE_S390_PV] =
VIR_TRISTATE_BOOL_YES;
+ else
+ domCaps->features[VIR_DOMAIN_CAPS_FEATURE_S390_PV] =
VIR_TRISTATE_BOOL_NO;
+ }
+}
+
+
int
virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
virArch hostarch,
@@ -6383,6 +6398,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
virQEMUCapsFillDomainDeviceFSCaps(qemuCaps, filesystem);
virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps);
+ virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps);
return 0;
}
diff --git a/tests/domaincapsdata/qemu_2.11.0.s390x.xml
b/tests/domaincapsdata/qemu_2.11.0.s390x.xml
index 9593fa17b7..a52e436538 100644
--- a/tests/domaincapsdata/qemu_2.11.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.11.0.s390x.xml
@@ -212,6 +212,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
+ <s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_2.12.0.s390x.xml
b/tests/domaincapsdata/qemu_2.12.0.s390x.xml
index f5851b9e23..f289a4893c 100644
--- a/tests/domaincapsdata/qemu_2.12.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_2.12.0.s390x.xml
@@ -212,6 +212,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
+ <s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_3.0.0.s390x.xml
b/tests/domaincapsdata/qemu_3.0.0.s390x.xml
index c298d6bf71..2aa34677c0 100644
--- a/tests/domaincapsdata/qemu_3.0.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_3.0.0.s390x.xml
@@ -219,6 +219,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
+ <s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_4.0.0.s390x.xml
b/tests/domaincapsdata/qemu_4.0.0.s390x.xml
index f1f4151635..ede04824e9 100644
--- a/tests/domaincapsdata/qemu_4.0.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_4.0.0.s390x.xml
@@ -229,6 +229,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
+ <s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml
b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
index febda17e6c..f344b289b2 100644
--- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
@@ -244,6 +244,7 @@
<genid supported='no'/>
<backingStoreInput supported='yes'/>
<backup supported='no'/>
+ <s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml
b/tests/domaincapsdata/qemu_5.2.0.s390x.xml
index 2d389c4c89..c30de65f88 100644
--- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml
@@ -246,6 +246,7 @@
<genid supported='no'/>
<backingStoreInput supported='yes'/>
<backup supported='no'/>
+ <s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>
diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml
b/tests/domaincapsdata/qemu_6.0.0.s390x.xml
index 49663bbdd3..d6d8262a34 100644
--- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml
@@ -247,6 +247,7 @@
<genid supported='no'/>
<backingStoreInput supported='yes'/>
<backup supported='no'/>
+ <s390-pv supported='yes'/>
<sev supported='no'/>
</features>
</domainCapabilities>
diff --git a/tests/domaincapsmock.c b/tests/domaincapsmock.c
index b03f75199b..7b02c0e890 100644
--- a/tests/domaincapsmock.c
+++ b/tests/domaincapsmock.c
@@ -17,6 +17,8 @@
#include <config.h>
#include "virhostcpu.h"
+#include "virmock.h"
+#include "qemu/qemu_capabilities.h"
int
virHostCPUGetKVMMaxVCPUs(void)
@@ -29,3 +31,18 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED)
{
return 0;
}
+
+static bool (*real_virQEMUCapsGetKVMSupportsSecureGuest)(virQEMUCaps *qemuCaps);
+
+bool
+virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps)
+{
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT) &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST))
+ return true;
+
+ if (!real_virQEMUCapsGetKVMSupportsSecureGuest)
+ VIR_MOCK_REAL_INIT(virQEMUCapsGetKVMSupportsSecureGuest);
+
+ return real_virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps);
+}
--
2.31.1