[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Name domain managed state file with domain UUID



A domain managed state file named with domain name can cause
problem if the domain is undefined, and a later new domain is
created with the same name. The new domain will not be able to
start.
---
 src/libxl/libxl_driver.c |    4 +++-
 src/qemu/qemu_driver.c   |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 586d562..7e4e261 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -220,8 +220,10 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
 static char *
 libxlDomainManagedSavePath(libxlDriverPrivatePtr driver, virDomainObjPtr vm) {
     char *ret;
+    char uuidstr[VIR_UUID_STRING_BUFLEN];
+    virUUIDFormat(vm->def->uuid, uuidstr);
 
-    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
+    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
         virReportOOMError();
         return NULL;
     }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a05a1ee..db77615 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2398,8 +2398,10 @@ cleanup:
 static char *
 qemuDomainManagedSavePath(struct qemud_driver *driver, virDomainObjPtr vm) {
     char *ret;
+    char uuidstr[VIR_UUID_STRING_BUFLEN];
+    virUUIDFormat(vm->def->uuid, uuidstr);
 
-    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
+    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
         virReportOOMError();
         return(NULL);
     }
-- 
1.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]