mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Prepare TPM when starting a domain
When starting a domain and separate mount namespace is used, we have to create all the /dev entries that are configured for the domain. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4e4451019c
commit
2c654490f3
@ -7146,6 +7146,35 @@ qemuDomainSetupAllChardevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainSetupTPM(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
virDomainObjPtr vm,
|
||||
const char *devPath)
|
||||
{
|
||||
virDomainTPMDefPtr dev = vm->def->tpm;
|
||||
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
VIR_DEBUG("Setting up TPM");
|
||||
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
|
||||
if (qemuDomainCreateDevice(dev->data.passthrough.source.data.file.path,
|
||||
devPath, false) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_TPM_TYPE_LAST:
|
||||
/* nada */
|
||||
break;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Setup TPM");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuDomainBuildNamespace(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
@ -7193,6 +7222,9 @@ qemuDomainBuildNamespace(virQEMUDriverPtr driver,
|
||||
if (qemuDomainSetupAllChardevs(driver, vm, devPath) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainSetupTPM(driver, vm, devPath) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (mount(devPath, "/dev", NULL, mount_flags, NULL) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to mount %s on /dev"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user