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 9871f4d..07fa900 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7018,6 +7018,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)
@@ -7060,6 +7089,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.8.4