qemu_security: Drop qemuSecurityStartVhostUserGPU()

There's no real difference between
qemuSecurityStartVhostUserGPU() and qemuSecurityCommandRun(). The
latter is used more frequently while the former has just one
user. Therefore, drop the less frequently used one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-04-28 13:19:11 +02:00
parent ae373781a4
commit 55c3e969cf
3 changed files with 1 additions and 48 deletions

View File

@ -499,46 +499,6 @@ qemuSecurityRestoreNetdevLabel(virQEMUDriver *driver,
}
/*
* qemuSecurityStartVhostUserGPU:
*
* @driver: the QEMU driver
* @vm: the domain object
* @cmd: the command to run
* @existstatus: pointer to int returning exit status of process
* @cmdret: pointer to int returning result of virCommandRun
*
* Start the vhost-user-gpu process with appropriate labels.
* 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
qemuSecurityStartVhostUserGPU(virQEMUDriver *driver,
virDomainObj *vm,
virCommand *cmd,
int *exitstatus,
int *cmdret)
{
if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
vm->def, cmd) < 0)
return -1;
if (virSecurityManagerPreFork(driver->securityManager) < 0)
return -1;
*cmdret = virCommandRun(cmd, exitstatus);
virSecurityManagerPostFork(driver->securityManager);
if (*cmdret < 0)
return -1;
return 0;
}
/*
* qemuSecurityStartTPMEmulator:
*

View File

@ -87,12 +87,6 @@ int qemuSecurityRestoreNetdevLabel(virQEMUDriver *driver,
virDomainObj *vm,
virDomainNetDef *net);
int qemuSecurityStartVhostUserGPU(virQEMUDriver *driver,
virDomainObj *vm,
virCommand *cmd,
int *exitstatus,
int *cmdret);
int qemuSecurityStartTPMEmulator(virQEMUDriver *driver,
virDomainObj *vm,
virCommand *cmd,

View File

@ -158,8 +158,7 @@ int qemuExtVhostUserGPUStart(virQEMUDriver *driver,
virCommandAddArgFormat(cmd, "--render-node=%s", video->accel->rendernode);
}
if (qemuSecurityStartVhostUserGPU(driver, vm, cmd,
&exitstatus, &cmdret) < 0)
if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
goto error;
if (cmdret < 0 || exitstatus != 0) {