mirror of https://gitee.com/openkylin/libvirt.git
qemu: add qemuSecurityStartVhostUserGPU helper
See function documentation. Used in a following patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
13248e1688
commit
019db0d944
|
@ -433,6 +433,46 @@ qemuSecurityRestoreChardevLabel(virQEMUDriverPtr 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 approriate 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(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virCommandPtr 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:
|
||||
*
|
||||
|
|
|
@ -77,6 +77,12 @@ int qemuSecurityRestoreChardevLabel(virQEMUDriverPtr driver,
|
|||
virDomainObjPtr vm,
|
||||
virDomainChrDefPtr chr);
|
||||
|
||||
int qemuSecurityStartVhostUserGPU(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virCommandPtr cmd,
|
||||
int *exitstatus,
|
||||
int *cmdret);
|
||||
|
||||
int qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virCommandPtr cmd,
|
||||
|
|
Loading…
Reference in New Issue