conf: Add availability of s390-pv in domain capabilities

Adding availability of s390-pv in domain capabilities and adjust tests.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Boris Fiuczynski 2021-07-16 11:44:32 +02:00 committed by Pavel Hrdina
parent b823f7a781
commit 248a30c0c0
12 changed files with 51 additions and 0 deletions

View File

@ -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"/>

View File

@ -42,6 +42,7 @@ VIR_ENUM_IMPL(virDomainCapsFeature,
"genid",
"backingStoreInput",
"backup",
"s390-pv",
);
static virClass *virDomainCapsClass;

View File

@ -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;

View File

@ -6340,6 +6340,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,
@ -6388,6 +6403,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
virQEMUCapsFillDomainDeviceFSCaps(qemuCaps, filesystem);
virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps);
return 0;
}

View File

@ -212,6 +212,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
<s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -212,6 +212,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
<s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -219,6 +219,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
<s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -229,6 +229,7 @@
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backup supported='no'/>
<s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -244,6 +244,7 @@
<genid supported='no'/>
<backingStoreInput supported='yes'/>
<backup supported='no'/>
<s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -246,6 +246,7 @@
<genid supported='no'/>
<backingStoreInput supported='yes'/>
<backup supported='no'/>
<s390-pv supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -247,6 +247,7 @@
<genid supported='no'/>
<backingStoreInput supported='yes'/>
<backup supported='no'/>
<s390-pv supported='yes'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -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);
}