提交 4e445101 编写于 作者: M Michal Privoznik

qemu: Prepare chardevs 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: NMichal Privoznik <mprivozn@redhat.com>
上级 73267cec
......@@ -7114,6 +7114,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)
......@@ -7158,6 +7190,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"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册