mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu: Prepare inputs 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
2c654490f3
commit
8ec8a8c5ff
@ -7175,6 +7175,52 @@ qemuDomainSetupTPM(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainSetupInput(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
virDomainInputDefPtr input,
|
||||
const char *devPath)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
switch ((virDomainInputType) input->type) {
|
||||
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
|
||||
if (qemuDomainCreateDevice(input->source.evdev, devPath, false) < 0)
|
||||
goto cleanup;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
|
||||
case VIR_DOMAIN_INPUT_TYPE_TABLET:
|
||||
case VIR_DOMAIN_INPUT_TYPE_KBD:
|
||||
case VIR_DOMAIN_INPUT_TYPE_LAST:
|
||||
/* nada */
|
||||
break;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainSetupAllInputs(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *devPath)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
VIR_DEBUG("Setting up disks");
|
||||
for (i = 0; i < vm->def->ninputs; i++) {
|
||||
if (qemuDomainSetupInput(driver,
|
||||
vm->def->inputs[i],
|
||||
devPath) < 0)
|
||||
return -1;
|
||||
}
|
||||
VIR_DEBUG("Setup all disks");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuDomainBuildNamespace(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
@ -7225,6 +7271,9 @@ qemuDomainBuildNamespace(virQEMUDriverPtr driver,
|
||||
if (qemuDomainSetupTPM(driver, vm, devPath) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainSetupAllInputs(driver, vm, devPath) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (mount(devPath, "/dev", NULL, mount_flags, NULL) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to mount %s on /dev"),
|
||||
|
Loading…
Reference in New Issue
Block a user