mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-22 14:50:27 +03:00
qemu_security: Introduce qemuSecuritySetTPMLabels()
Now that we have qemuSecurityRestoreTPMLabels() we might as well have qemuSecuritySetTPMLabels(). The aim here is to remove qemuSecurityStartTPMEmulator() which couples two separate things into a single function call. Therefore, introduce qemuSecuritySetTPMLabels() which does only set seclabels on the TPM state. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
51b92836ff
commit
bdbb8e7b00
@ -576,6 +576,32 @@ qemuSecurityStartTPMEmulator(virQEMUDriver *driver,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuSecuritySetTPMLabels(virQEMUDriver *driver,
|
||||
virDomainObj *vm,
|
||||
bool setTPMStateLabel)
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (virSecurityManagerTransactionStart(driver->securityManager) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virSecurityManagerSetTPMLabels(driver->securityManager,
|
||||
vm->def, setTPMStateLabel) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virSecurityManagerTransactionCommit(driver->securityManager,
|
||||
-1, priv->rememberOwner) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virSecurityManagerTransactionAbort(driver->securityManager);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuSecurityRestoreTPMLabels(virQEMUDriver *driver,
|
||||
virDomainObj *vm,
|
||||
|
@ -94,6 +94,10 @@ int qemuSecurityStartTPMEmulator(virQEMUDriver *driver,
|
||||
int *exitstatus,
|
||||
int *cmdret);
|
||||
|
||||
int qemuSecuritySetTPMLabels(virQEMUDriver *driver,
|
||||
virDomainObj *vm,
|
||||
bool setTPMStateLabel);
|
||||
|
||||
int qemuSecurityRestoreTPMLabels(virQEMUDriver *driver,
|
||||
virDomainObj *vm,
|
||||
bool restoreTPMStateLabel);
|
||||
|
Loading…
x
Reference in New Issue
Block a user