On Wed, Dec 08, 2021 at 18:44:32 +0000, Daniel P. Berrangé wrote:
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
https://bugzilla.redhat.com/show_bug.cgi?id=2030435
Also a rather sparse commit message. For justification you can use what
you've put into the comment for the function calling query-sev.
src/qemu/qemu_driver.c | 41
+++++++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5bacf73003..e1296d3723 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19977,14 +19977,19 @@ qemuNodeGetSEVInfo(virConnectPtr conn,
static int
-qemuDomainGetSEVMeasurement(virQEMUDriver *driver,
- virDomainObj *vm,
- virTypedParameterPtr *params,
- int *nparams,
- unsigned int flags)
+qemuDomainGetSEVInfo(virQEMUDriver *driver,
+ virDomainObj *vm,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags)
{
int ret = -1;
+ int rv;
g_autofree char *tmp = NULL;
+ unsigned int apiMajor = 0;
+ unsigned int apiMinor = 0;
+ unsigned int buildID = 0;
+ unsigned int policy = 0;
int maxpar = 0;
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
@@ -20006,10 +20011,34 @@ qemuDomainGetSEVMeasurement(virQEMUDriver *driver,
if (!tmp)
goto endjob;
+ qemuDomainObjEnterMonitor(driver, vm);
+ rv = qemuMonitorGetSEVInfo(QEMU_DOMAIN_PRIVATE(vm)->mon,
+ &apiMajor, &apiMinor, &buildID,
&policy);
+ qemuDomainObjExitMonitor(driver, vm);
You don't have to enter monitor twice to do two calls.
+
+ if (rv < 0)
+ goto endjob;
+
if (virTypedParamsAddString(params, nparams, &maxpar,
VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT,
tmp) < 0)
Once you merge the monitor blocks:
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>