[PATCH 6/7] qemu_security: Drop qemuSecurityStartTPMEmulator()

Michal Privoznik mprivozn at redhat.com
Wed Dec 21 07:43:56 UTC 2022


After previous cleanup this function is no longer used and thus
can be dropped.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_security.c | 77 ----------------------------------------
 src/qemu/qemu_security.h |  9 -----
 2 files changed, 86 deletions(-)

diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c
index daf01bb803..beada669f7 100644
--- a/src/qemu/qemu_security.c
+++ b/src/qemu/qemu_security.c
@@ -499,83 +499,6 @@ qemuSecurityRestoreNetdevLabel(virQEMUDriver *driver,
 }
 
 
-/*
- * qemuSecurityStartTPMEmulator:
- *
- * @driver: the QEMU driver
- * @vm: the domain object
- * @cmd: the command to run
- * @uid: the uid to run the emulator
- * @gid: the gid to run the emulator
- * @setTPMStateLabel: whether TPM state should be labelled, or just logfile
- * @existstatus: pointer to int returning exit status of process
- * @cmdret: pointer to int returning result of virCommandRun
- *
- * Start the TPM emulator with appropriate labels. Apply security
- * labels to files first.
- * This function returns -1 on security setup error, 0 if all the
- * setup was done properly. In case the virCommand failed to run
- * 0 is returned but cmdret is set appropriately with the process
- * exitstatus also set.
- */
-int
-qemuSecurityStartTPMEmulator(virQEMUDriver *driver,
-                             virDomainObj *vm,
-                             virCommand *cmd,
-                             uid_t uid,
-                             gid_t gid,
-                             bool setTPMStateLabel,
-                             int *exitstatus,
-                             int *cmdret)
-{
-    qemuDomainObjPrivate *priv = vm->privateData;
-    int ret = -1;
-    bool transactionStarted = false;
-
-    if (virSecurityManagerTransactionStart(driver->securityManager) < 0)
-        return -1;
-    transactionStarted = true;
-
-    if (virSecurityManagerSetTPMLabels(driver->securityManager,
-                                       vm->def, setTPMStateLabel) < 0) {
-        virSecurityManagerTransactionAbort(driver->securityManager);
-        return -1;
-    }
-
-    if (virSecurityManagerTransactionCommit(driver->securityManager,
-                                            -1, priv->rememberOwner) < 0)
-        goto cleanup_abort;
-    transactionStarted = false;
-
-    if (qemuSecurityCommandRun(driver, vm, cmd, uid, gid, exitstatus, cmdret) < 0)
-        goto cleanup;
-
-    ret = 0;
-
-    if (*cmdret < 0)
-        goto cleanup;
-
-    return 0;
-
- cleanup:
-    if (!transactionStarted &&
-        virSecurityManagerTransactionStart(driver->securityManager) >= 0)
-        transactionStarted = true;
-
-    virSecurityManagerRestoreTPMLabels(driver->securityManager,
-                                       vm->def, setTPMStateLabel);
-
-    if (transactionStarted &&
-        virSecurityManagerTransactionCommit(driver->securityManager,
-                                            -1, priv->rememberOwner) < 0)
-        VIR_WARN("Unable to run security manager transaction");
-
- cleanup_abort:
-    virSecurityManagerTransactionAbort(driver->securityManager);
-    return ret;
-}
-
-
 int
 qemuSecuritySetTPMLabels(virQEMUDriver *driver,
                          virDomainObj *vm,
diff --git a/src/qemu/qemu_security.h b/src/qemu/qemu_security.h
index 198f8ef0d4..8d1c6b38c3 100644
--- a/src/qemu/qemu_security.h
+++ b/src/qemu/qemu_security.h
@@ -85,15 +85,6 @@ int qemuSecurityRestoreNetdevLabel(virQEMUDriver *driver,
                                    virDomainObj *vm,
                                    virDomainNetDef *net);
 
-int qemuSecurityStartTPMEmulator(virQEMUDriver *driver,
-                                 virDomainObj *vm,
-                                 virCommand *cmd,
-                                 uid_t uid,
-                                 gid_t gid,
-                                 bool setTPMStateLabel,
-                                 int *exitstatus,
-                                 int *cmdret);
-
 int qemuSecuritySetTPMLabels(virQEMUDriver *driver,
                              virDomainObj *vm,
                              bool setTPMStateLabel);
-- 
2.38.2



More information about the libvir-list mailing list