mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 13:17:58 +03:00
Revert "tpm: Check TPM XML device configuration changes after edit"
Redefining a domain via virDomainDefineXML should not give different results
based on an already existing definition.
Also, there's a crasher somewhere in the code:
https://bugzilla.redhat.com/show_bug.cgi?id=1739338
This reverts commit 94b3aa55f8
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
2ab689eec1
commit
d8326cb882
@ -31470,59 +31470,3 @@ virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainCheckTPMChanges(virDomainDefPtr def,
|
||||
virDomainDefPtr newDef)
|
||||
{
|
||||
bool oldEnc, newEnc;
|
||||
|
||||
if (!def->tpm)
|
||||
return 0;
|
||||
|
||||
switch (def->tpm->type) {
|
||||
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
|
||||
if (virFileExists(def->tpm->data.emulator.storagepath)) {
|
||||
/* VM has been started */
|
||||
/* Once a VM was started with an encrypted state we allow
|
||||
* less configuration changes.
|
||||
*/
|
||||
oldEnc = def->tpm->data.emulator.hassecretuuid;
|
||||
if (oldEnc && def->tpm->type != newDef->tpm->type) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Changing the type of TPM is not allowed"));
|
||||
return -1;
|
||||
}
|
||||
if (oldEnc && !newDef->tpm) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Removing an encrypted TPM is not allowed"));
|
||||
return -1;
|
||||
}
|
||||
newEnc = newDef->tpm->data.emulator.hassecretuuid;
|
||||
if (oldEnc != newEnc) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("TPM state encryption cannot be changed "
|
||||
"once VM was started"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
|
||||
case VIR_DOMAIN_TPM_TYPE_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virDomainCheckDeviceChanges(virDomainDefPtr def,
|
||||
virDomainDefPtr newDef)
|
||||
{
|
||||
if (!def || !newDef)
|
||||
return 0;
|
||||
|
||||
return virDomainCheckTPMChanges(def, newDef);
|
||||
}
|
||||
|
@ -3646,6 +3646,3 @@ virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics);
|
||||
|
||||
bool
|
||||
virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics);
|
||||
|
||||
int
|
||||
virDomainCheckDeviceChanges(virDomainDefPtr def, virDomainDefPtr newDef);
|
||||
|
@ -217,7 +217,6 @@ virDomainBootTypeFromString;
|
||||
virDomainBootTypeToString;
|
||||
virDomainCapabilitiesPolicyTypeToString;
|
||||
virDomainCapsFeatureTypeToString;
|
||||
virDomainCheckDeviceChanges;
|
||||
virDomainChrConsoleTargetTypeFromString;
|
||||
virDomainChrConsoleTargetTypeToString;
|
||||
virDomainChrDefForeach;
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include "qemu_migration_params.h"
|
||||
#include "qemu_blockjob.h"
|
||||
#include "qemu_security.h"
|
||||
#include "qemu_extdevice.h"
|
||||
|
||||
#include "virerror.h"
|
||||
#include "virlog.h"
|
||||
@ -7776,30 +7775,6 @@ qemuDomainCreate(virDomainPtr dom)
|
||||
return qemuDomainCreateWithFlags(dom, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainCheckDeviceChanges(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
virDomainObjPtr vm;
|
||||
int ret;
|
||||
|
||||
vm = virDomainObjListFindByUUID(driver->domains, def->uuid);
|
||||
if (!vm)
|
||||
return 0;
|
||||
|
||||
if (qemuExtDevicesInitPaths(driver, vm->def) < 0) {
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = virDomainCheckDeviceChanges(vm->def, def);
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static virDomainPtr
|
||||
qemuDomainDefineXMLFlags(virConnectPtr conn,
|
||||
const char *xml,
|
||||
@ -7836,9 +7811,6 @@ qemuDomainDefineXMLFlags(virConnectPtr conn,
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainCheckDeviceChanges(driver, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = virDomainObjListAdd(driver->domains, def,
|
||||
driver->xmlopt,
|
||||
0, &oldDef)))
|
||||
|
@ -79,7 +79,7 @@ qemuExtDeviceLogCommand(qemuDomainLogContextPtr logCtxt,
|
||||
* stored and we can remove directories and files in case of domain XML
|
||||
* changes.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
qemuExtDevicesInitPaths(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
|
@ -54,6 +54,3 @@ bool qemuExtDevicesHasDevice(virDomainDefPtr def);
|
||||
int qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def,
|
||||
virCgroupPtr cgroup);
|
||||
|
||||
int qemuExtDevicesInitPaths(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def);
|
||||
|
Loading…
Reference in New Issue
Block a user