mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00: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
|
int
|
||||||
qemuSecurityRestoreTPMLabels(virQEMUDriver *driver,
|
qemuSecurityRestoreTPMLabels(virQEMUDriver *driver,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
|
@ -94,6 +94,10 @@ int qemuSecurityStartTPMEmulator(virQEMUDriver *driver,
|
|||||||
int *exitstatus,
|
int *exitstatus,
|
||||||
int *cmdret);
|
int *cmdret);
|
||||||
|
|
||||||
|
int qemuSecuritySetTPMLabels(virQEMUDriver *driver,
|
||||||
|
virDomainObj *vm,
|
||||||
|
bool setTPMStateLabel);
|
||||||
|
|
||||||
int qemuSecurityRestoreTPMLabels(virQEMUDriver *driver,
|
int qemuSecurityRestoreTPMLabels(virQEMUDriver *driver,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
bool restoreTPMStateLabel);
|
bool restoreTPMStateLabel);
|
||||||
|
Loading…
Reference in New Issue
Block a user