directory /var/lib alway is Persistence directory, but in redhat system, /var/run is
memory directory.
our running domain xml is saved at /var/run/libvirt/qemu. so if we cold reset system,
the /var/run/libvirt/qemu directory is clear, but /var/lib/libvirt/qemu/domain-*** is
saved., so there
have same /var/lib/libvirt/qemu/domain-*** directory will be left over at system cold
reset.
---
src/qemu/qemu_domain.c | 2 +-
tests/qemuxml2argvtest.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 13e77ee..67da8fa 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1713,7 +1713,7 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
goto cleanup;
if (!priv->libDir &&
- virAsprintf(&priv->libDir, "%s/domain-%s", cfg->libDir,
domname) < 0)
+ virAsprintf(&priv->libDir, "%s/domain-%s", cfg->stateDir,
domname) < 0)
goto cleanup;
if (!priv->channelTargetDir &&
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 03b1bcb..b596bd2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -620,6 +620,10 @@ mymain(void)
if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir,
"/var/lib/libvirt/qemu/ram") < 0)
return EXIT_FAILURE;
+ VIR_FREE(driver.config->stateDir);
+ if (VIR_STRDUP(driver.config->stateDir, "/tmp/lib") < 0)
+ return EXIT_FAILURE;
+
# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \
parseFlags, gic, ...) \
do { \
--
2.8.3