From: Shaju Abraham <shaju.abraham(a)nutanix.com>
There are various config paths that a VM uses. The monitor paths and
other lib paths are examples. These paths are tied to the VM name or
UUID. The local migration breaks the assumption that there will be only
one VM with a unique UUID and name. During local migrations there can be
multiple VMs with same name and UUID in the same host. Append the
domain-id field to the path so that there is no duplication of path
names.
Signed-off-by: Shaju Abraham <shaju.abraham(a)nutanix.com>
---
src/qemu/qemu_conf.c | 4 ++--
src/qemu/qemu_domain.c | 16 ++++++++++------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 00801ef01b..6769736d58 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1894,7 +1894,7 @@ qemuGetDomainHugepagePath(const virDomainDef *def,
char *ret = NULL;
if (base && domPath)
- ret = g_strdup_printf("%s/%s", base, domPath);
+ ret = g_strdup_printf("%s/%s-%d", base, domPath, def->id);
return ret;
}
@@ -1962,7 +1962,7 @@ qemuGetMemoryBackingDomainPath(const virDomainDef *def,
return -1;
qemuGetMemoryBackingBasePath(cfg, &base);
- *path = g_strdup_printf("%s/%s", base, shortName);
+ *path = g_strdup_printf("%s/%s-%d", base, shortName, def->id);
return 0;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b0c0e1a19b..002c092cf8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2127,11 +2127,13 @@ qemuDomainSetPrivatePathsOld(virQEMUDriverPtr driver,
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
if (!priv->libDir)
- priv->libDir = g_strdup_printf("%s/domain-%s", cfg->libDir,
vm->def->name);
+ priv->libDir = g_strdup_printf("%s/domain-%s-%d", cfg->libDir,
+ vm->def->name, vm->def->id);
if (!priv->channelTargetDir)
- priv->channelTargetDir = g_strdup_printf("%s/domain-%s",
- cfg->channelTargetDir,
vm->def->name);
+ priv->channelTargetDir = g_strdup_printf("%s/domain-%s-%d",
+ cfg->channelTargetDir,
+ vm->def->name,
vm->def->id);
virObjectUnref(cfg);
}
@@ -2150,11 +2152,13 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
goto cleanup;
if (!priv->libDir)
- priv->libDir = g_strdup_printf("%s/domain-%s", cfg->libDir,
domname);
+ priv->libDir = g_strdup_printf("%s/domain-%s-%d", cfg->libDir,
domname,
+ vm->def->id);
if (!priv->channelTargetDir)
- priv->channelTargetDir = g_strdup_printf("%s/domain-%s",
- cfg->channelTargetDir, domname);
+ priv->channelTargetDir = g_strdup_printf("%s/domain-%s-%d",
+ cfg->channelTargetDir,
+ domname, vm->def->id);
ret = 0;
cleanup:
--
2.24.1