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(a)redhat.com>
---
src/qemu/qemu_domain.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6cff3c92e..9beca4cd3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7099,6 +7099,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)
@@ -7140,6 +7169,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"),
--
2.11.0