mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
qemu: process: Move SEV capability check to qemuValidateDomainDef
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>
This commit is contained in:
parent
649f720a9a
commit
1fdc907325
@ -6393,8 +6393,6 @@ qemuProcessSEVCreateFile(virDomainObjPtr vm,
|
||||
static int
|
||||
qemuProcessPrepareSEVGuestInput(virDomainObjPtr vm)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
|
||||
virDomainSEVDefPtr sev = vm->def->sev;
|
||||
|
||||
if (!sev)
|
||||
@ -6402,13 +6400,6 @@ qemuProcessPrepareSEVGuestInput(virDomainObjPtr vm)
|
||||
|
||||
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;
|
||||
|
@ -1210,6 +1210,14 @@ qemuValidateDomainDef(const virDomainDef *def,
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user