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 | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 17fb3d0..9871f4d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6986,6 +6986,38 @@ qemuDomainSetupAllHostdevs(virQEMUDriverPtr driver,
}
+static int
+qemuDomainSetupChardev(virDomainDefPtr def ATTRIBUTE_UNUSED,
+ virDomainChrDefPtr dev,
+ void *opaque)
+{
+ const char *devPath = opaque;
+
+ if (dev->source->type != VIR_DOMAIN_CHR_TYPE_DEV)
+ return 0;
+
+ return qemuDomainCreateDevice(dev->source->data.file.path, devPath, false);
+}
+
+
+static int
+qemuDomainSetupAllChardevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm,
+ const char *devPath)
+{
+ VIR_DEBUG("Setting up chardevs");
+
+ if (virDomainChrDefForeach(vm->def,
+ true,
+ qemuDomainSetupChardev,
+ (void *) devPath) < 0)
+ return -1;
+
+ VIR_DEBUG("Setup all chardevs");
+ return 0;
+}
+
+
int
qemuDomainBuildNamespace(virQEMUDriverPtr driver,
virDomainObjPtr vm)
@@ -7025,6 +7057,9 @@ qemuDomainBuildNamespace(virQEMUDriverPtr driver,
if (qemuDomainSetupAllHostdevs(driver, vm, devPath) < 0)
goto cleanup;
+ if (qemuDomainSetupAllChardevs(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