virDomainObj *vm;
int ret = -1;
int rc;
- g_autoptr(virQEMUCaps) qemucaps = NULL;
const char *secrethdr = NULL;
const char *secret = NULL;
unsigned long long setaddr = 0;
bool hasSetaddr = false;
int state;
+ qemuDomainObjPrivate *priv;
virCheckFlags(0, -1);
if (virTypedParamsValidate(params, nparams,
if (!(vm = qemuDomainObjFromDomain(domain)))
goto cleanup;
+ priv = vm->privateData;
+
if (virDomainSetLaunchSecurityStateEnsureACL(domain->conn, vm->def) < 0)
goto cleanup;
goto cleanup;
}
- if (!(qemucaps = virQEMUCapsCacheLookupDefault(driver->qemuCapsCache,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL)))
- goto cleanup;
-
- if (!virQEMUCapsGet(qemucaps, QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("QEMU does not support setting a launch secret"));
- goto cleanup;
- }
-
if (virTypedParamsGetString(params, nparams,
VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_HEADER,
&secrethdr) < 0 ||
goto endjob;
}
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("QEMU does not support setting a launch secret"));
+ goto endjob;
+ }
+
qemuDomainObjEnterMonitor(driver, vm);
rc = qemuMonitorSetLaunchSecurityState(QEMU_DOMAIN_PRIVATE(vm)->mon,
secrethdr, secret, setaddr, hasSetaddr);