Checks such as this one should be done at domain def validation time,
not before starting the QEMU process.
As for this change, existing domains will see some QEMU error when
starting as opposed to a libvirt error that this QEMU binary doesn't
support SEV, but that's okay, we never guaranteed error messages to
remain the same.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
static int
qemuProcessPrepareSEVGuestInput(virDomainObjPtr vm)
{
- qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUCapsPtr qemuCaps = priv->qemuCaps;
virDomainSEVDefPtr sev = vm->def->sev;
if (!sev)
VIR_DEBUG("Preparing SEV guest");
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Domain %s asked for 'sev' launch but this "
- "QEMU does not support SEV feature"), vm->def->name);
- return -1;
- }
-
if (sev->dh_cert) {
if (qemuProcessSEVCreateFile(vm, "dh_cert", sev->dh_cert) < 0)
return -1;
if (qemuValidateDomainDefPanic(def, qemuCaps) < 0)
return -1;
+ if (def->sev &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("SEV launch security is not supported with "
+ "this QEMU binary"));
+ return -1;
+ }
+
return 0;
}