|
|
3e5111 |
From 382795a4ab74f29b1a5bdf3ea3aa33d17d2add56 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <382795a4ab74f29b1a5bdf3ea3aa33d17d2add56@dist-git>
|
|
|
3e5111 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3e5111 |
Date: Thu, 11 May 2017 15:38:38 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemuDomainCreateDeviceRecursive: pass a structure instead of
|
|
|
3e5111 |
bare path
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1449510
|
|
|
3e5111 |
|
|
|
3e5111 |
Currently, all we need to do in qemuDomainCreateDeviceRecursive() is to
|
|
|
3e5111 |
take given @device, get all kinds of info on it (major & minor numbers,
|
|
|
3e5111 |
owner, seclabels) and create its copy at a temporary location @path
|
|
|
3e5111 |
(usually /var/run/libvirt/qemu/$domName.dev), if @device live under
|
|
|
3e5111 |
/dev. This is, however, very loose condition, as it also means
|
|
|
3e5111 |
/dev/shm/* is created too. Therefor, we will need to pass more arguments
|
|
|
3e5111 |
into the function for better decision making (e.g. list of mount points
|
|
|
3e5111 |
under /dev). Instead of adding more arguments to all the functions (not
|
|
|
3e5111 |
easily reachable because some functions are callback with strictly
|
|
|
3e5111 |
defined type), lets just turn this one 'const char *' into a 'struct *'.
|
|
|
3e5111 |
New "arguments" can be then added at no cost.
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3e5111 |
Reviewed-by: Cedric Bosdonnat <cbosdonnat@suse.com>
|
|
|
3e5111 |
(cherry picked from commit 26c14be8d64bc9e3c23b95fff65affc2bf7c86bc)
|
|
|
3e5111 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_domain.c | 106 ++++++++++++++++++++++++++-----------------------
|
|
|
3e5111 |
1 file changed, 57 insertions(+), 49 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
index fbb65fab4..bbf865e12 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
@@ -7413,9 +7413,14 @@ qemuDomainGetPreservedMounts(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
+struct qemuDomainCreateDeviceData {
|
|
|
3e5111 |
+ const char *path; /* Path to temp new /dev location */
|
|
|
3e5111 |
+};
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainCreateDeviceRecursive(const char *device,
|
|
|
3e5111 |
- const char *path,
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data,
|
|
|
3e5111 |
bool allow_noent,
|
|
|
3e5111 |
unsigned int ttl)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
@@ -7464,7 +7469,7 @@ qemuDomainCreateDeviceRecursive(const char *device,
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
if (STRPREFIX(device, DEVPREFIX)) {
|
|
|
3e5111 |
if (virAsprintf(&devicePath, "%s/%s",
|
|
|
3e5111 |
- path, device + strlen(DEVPREFIX)) < 0)
|
|
|
3e5111 |
+ data->path, device + strlen(DEVPREFIX)) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (virFileMakeParentPath(devicePath) < 0) {
|
|
|
3e5111 |
@@ -7525,7 +7530,7 @@ qemuDomainCreateDeviceRecursive(const char *device,
|
|
|
3e5111 |
tmp = NULL;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainCreateDeviceRecursive(target, path,
|
|
|
3e5111 |
+ if (qemuDomainCreateDeviceRecursive(target, data,
|
|
|
3e5111 |
allow_noent, ttl - 1) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
} else {
|
|
|
3e5111 |
@@ -7609,12 +7614,12 @@ qemuDomainCreateDeviceRecursive(const char *device,
|
|
|
3e5111 |
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainCreateDevice(const char *device,
|
|
|
3e5111 |
- const char *path,
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data,
|
|
|
3e5111 |
bool allow_noent)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
long symloop_max = sysconf(_SC_SYMLOOP_MAX);
|
|
|
3e5111 |
|
|
|
3e5111 |
- return qemuDomainCreateDeviceRecursive(device, path,
|
|
|
3e5111 |
+ return qemuDomainCreateDeviceRecursive(device, data,
|
|
|
3e5111 |
allow_noent, symloop_max);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7622,7 +7627,7 @@ qemuDomainCreateDevice(const char *device,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainPopulateDevices(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
- const char *path)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
const char *const *devices = (const char *const *) cfg->cgroupDeviceACL;
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
@@ -7632,7 +7637,7 @@ qemuDomainPopulateDevices(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
devices = defaultDeviceACL;
|
|
|
3e5111 |
|
|
|
3e5111 |
for (i = 0; devices[i]; i++) {
|
|
|
3e5111 |
- if (qemuDomainCreateDevice(devices[i], path, true) < 0)
|
|
|
3e5111 |
+ if (qemuDomainCreateDevice(devices[i], data, true) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7646,7 +7651,7 @@ static int
|
|
|
3e5111 |
qemuDomainSetupDev(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virSecurityManagerPtr mgr,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *path)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
char *mount_options = NULL;
|
|
|
3e5111 |
char *opts = NULL;
|
|
|
3e5111 |
@@ -7668,10 +7673,10 @@ qemuDomainSetupDev(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
"mode=755,size=65536%s", mount_options) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (virFileSetupDev(path, opts) < 0)
|
|
|
3e5111 |
+ if (virFileSetupDev(data->path, opts) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainPopulateDevices(cfg, vm, path) < 0)
|
|
|
3e5111 |
+ if (qemuDomainPopulateDevices(cfg, vm, data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
ret = 0;
|
|
|
3e5111 |
@@ -7685,7 +7690,7 @@ qemuDomainSetupDev(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupDisk(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainDiskDefPtr disk,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
virStorageSourcePtr next;
|
|
|
3e5111 |
char *dst = NULL;
|
|
|
3e5111 |
@@ -7697,7 +7702,7 @@ qemuDomainSetupDisk(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
continue;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainCreateDevice(next->path, devPath, false) < 0)
|
|
|
3e5111 |
+ if (qemuDomainCreateDevice(next->path, data, false) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7711,7 +7716,7 @@ qemuDomainSetupDisk(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupAllDisks(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
VIR_DEBUG("Setting up disks");
|
|
|
3e5111 |
@@ -7719,7 +7724,7 @@ qemuDomainSetupAllDisks(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
for (i = 0; i < vm->def->ndisks; i++) {
|
|
|
3e5111 |
if (qemuDomainSetupDisk(cfg,
|
|
|
3e5111 |
vm->def->disks[i],
|
|
|
3e5111 |
- devPath) < 0)
|
|
|
3e5111 |
+ data) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7731,7 +7736,7 @@ qemuDomainSetupAllDisks(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainHostdevDefPtr dev,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
int ret = -1;
|
|
|
3e5111 |
char **path = NULL;
|
|
|
3e5111 |
@@ -7741,7 +7746,7 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
for (i = 0; i < npaths; i++) {
|
|
|
3e5111 |
- if (qemuDomainCreateDevice(path[i], devPath, false) < 0)
|
|
|
3e5111 |
+ if (qemuDomainCreateDevice(path[i], data, false) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7757,7 +7762,7 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupAllHostdevs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7765,7 +7770,7 @@ qemuDomainSetupAllHostdevs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
for (i = 0; i < vm->def->nhostdevs; i++) {
|
|
|
3e5111 |
if (qemuDomainSetupHostdev(cfg,
|
|
|
3e5111 |
vm->def->hostdevs[i],
|
|
|
3e5111 |
- devPath) < 0)
|
|
|
3e5111 |
+ data) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
VIR_DEBUG("Setup all hostdevs");
|
|
|
3e5111 |
@@ -7776,19 +7781,19 @@ qemuDomainSetupAllHostdevs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupMemory(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainMemoryDefPtr mem,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
if (mem->model != VIR_DOMAIN_MEMORY_MODEL_NVDIMM)
|
|
|
3e5111 |
return 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
- return qemuDomainCreateDevice(mem->nvdimmPath, devPath, false);
|
|
|
3e5111 |
+ return qemuDomainCreateDevice(mem->nvdimmPath, data, false);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupAllMemories(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7796,7 +7801,7 @@ qemuDomainSetupAllMemories(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
for (i = 0; i < vm->def->nmems; i++) {
|
|
|
3e5111 |
if (qemuDomainSetupMemory(cfg,
|
|
|
3e5111 |
vm->def->mems[i],
|
|
|
3e5111 |
- devPath) < 0)
|
|
|
3e5111 |
+ data) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
VIR_DEBUG("Setup all memories");
|
|
|
3e5111 |
@@ -7809,26 +7814,26 @@ qemuDomainSetupChardev(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainChrDefPtr dev,
|
|
|
3e5111 |
void *opaque)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
- const char *devPath = opaque;
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data = opaque;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (dev->source->type != VIR_DOMAIN_CHR_TYPE_DEV)
|
|
|
3e5111 |
return 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
- return qemuDomainCreateDevice(dev->source->data.file.path, devPath, false);
|
|
|
3e5111 |
+ return qemuDomainCreateDevice(dev->source->data.file.path, data, false);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupAllChardevs(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
VIR_DEBUG("Setting up chardevs");
|
|
|
3e5111 |
|
|
|
3e5111 |
if (virDomainChrDefForeach(vm->def,
|
|
|
3e5111 |
true,
|
|
|
3e5111 |
qemuDomainSetupChardev,
|
|
|
3e5111 |
- (void *) devPath) < 0)
|
|
|
3e5111 |
+ (void *) data) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
VIR_DEBUG("Setup all chardevs");
|
|
|
3e5111 |
@@ -7839,7 +7844,7 @@ qemuDomainSetupAllChardevs(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupTPM(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
virDomainTPMDefPtr dev = vm->def->tpm;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7851,7 +7856,7 @@ qemuDomainSetupTPM(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
switch (dev->type) {
|
|
|
3e5111 |
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
|
|
|
3e5111 |
if (qemuDomainCreateDevice(dev->data.passthrough.source.data.file.path,
|
|
|
3e5111 |
- devPath, false) < 0)
|
|
|
3e5111 |
+ data, false) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7868,7 +7873,7 @@ qemuDomainSetupTPM(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupGraphics(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainGraphicsDefPtr gfx,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
const char *rendernode = gfx->data.spice.rendernode;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7877,14 +7882,14 @@ qemuDomainSetupGraphics(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
!rendernode)
|
|
|
3e5111 |
return 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
- return qemuDomainCreateDevice(rendernode, devPath, false);
|
|
|
3e5111 |
+ return qemuDomainCreateDevice(rendernode, data, false);
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupAllGraphics(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7892,7 +7897,7 @@ qemuDomainSetupAllGraphics(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
for (i = 0; i < vm->def->ngraphics; i++) {
|
|
|
3e5111 |
if (qemuDomainSetupGraphics(cfg,
|
|
|
3e5111 |
vm->def->graphics[i],
|
|
|
3e5111 |
- devPath) < 0)
|
|
|
3e5111 |
+ data) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7904,13 +7909,13 @@ qemuDomainSetupAllGraphics(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupInput(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainInputDefPtr input,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
int ret = -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
switch ((virDomainInputType) input->type) {
|
|
|
3e5111 |
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
|
|
|
3e5111 |
- if (qemuDomainCreateDevice(input->source.evdev, devPath, false) < 0)
|
|
|
3e5111 |
+ if (qemuDomainCreateDevice(input->source.evdev, data, false) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7931,7 +7936,7 @@ qemuDomainSetupInput(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupAllInputs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7939,7 +7944,7 @@ qemuDomainSetupAllInputs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
for (i = 0; i < vm->def->ninputs; i++) {
|
|
|
3e5111 |
if (qemuDomainSetupInput(cfg,
|
|
|
3e5111 |
vm->def->inputs[i],
|
|
|
3e5111 |
- devPath) < 0)
|
|
|
3e5111 |
+ data) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
VIR_DEBUG("Setup all inputs");
|
|
|
3e5111 |
@@ -7950,11 +7955,11 @@ qemuDomainSetupAllInputs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupRNG(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
virDomainRNGDefPtr rng,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
switch ((virDomainRNGBackend) rng->backend) {
|
|
|
3e5111 |
case VIR_DOMAIN_RNG_BACKEND_RANDOM:
|
|
|
3e5111 |
- if (qemuDomainCreateDevice(rng->source.file, devPath, false) < 0)
|
|
|
3e5111 |
+ if (qemuDomainCreateDevice(rng->source.file, data, false) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
case VIR_DOMAIN_RNG_BACKEND_EGD:
|
|
|
3e5111 |
@@ -7970,7 +7975,7 @@ qemuDomainSetupRNG(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainSetupAllRNGs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- const char *devPath)
|
|
|
3e5111 |
+ const struct qemuDomainCreateDeviceData *data)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
size_t i;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7978,7 +7983,7 @@ qemuDomainSetupAllRNGs(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
for (i = 0; i < vm->def->nrngs; i++) {
|
|
|
3e5111 |
if (qemuDomainSetupRNG(cfg,
|
|
|
3e5111 |
vm->def->rngs[i],
|
|
|
3e5111 |
- devPath) < 0)
|
|
|
3e5111 |
+ data) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -7992,6 +7997,7 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virSecurityManagerPtr mgr,
|
|
|
3e5111 |
virDomainObjPtr vm)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
+ struct qemuDomainCreateDeviceData data;
|
|
|
3e5111 |
char *devPath = NULL;
|
|
|
3e5111 |
char **devMountsPath = NULL, **devMountsSavePath = NULL;
|
|
|
3e5111 |
size_t ndevMountsPath = 0, i;
|
|
|
3e5111 |
@@ -8020,34 +8026,36 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
+ data.path = devPath;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
if (virProcessSetupPrivateMountNS() < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupDev(cfg, mgr, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupDev(cfg, mgr, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupAllDisks(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupAllDisks(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupAllHostdevs(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupAllHostdevs(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupAllMemories(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupAllMemories(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupAllChardevs(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupAllChardevs(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupTPM(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupTPM(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupAllGraphics(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupAllGraphics(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupAllInputs(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupAllInputs(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuDomainSetupAllRNGs(cfg, vm, devPath) < 0)
|
|
|
3e5111 |
+ if (qemuDomainSetupAllRNGs(cfg, vm, &data) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
/* Save some mount points because we want to share them with the host */
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.13.0
|
|
|
3e5111 |
|