[PATCH 6/7] conf: snapshot: rename variable holding memory snapshot file location

Peter Krempa pkrempa at redhat.com
Wed Jun 16 15:05:36 UTC 2021


'file' is too generic to know what's going on. Rename it to
'memorysnapshotfile'.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/snapshot_conf.c | 10 +++++-----
 src/conf/snapshot_conf.h |  2 +-
 src/qemu/qemu_snapshot.c |  8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index df3f2a4c63..0592640dd9 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -125,7 +125,7 @@ virDomainSnapshotDefDispose(void *obj)
     virDomainSnapshotDef *def = obj;
     size_t i;

-    g_free(def->file);
+    g_free(def->memorysnapshotfile);
     for (i = 0; i < def->ndisks; i++)
         virDomainSnapshotDiskDefClear(&def->disks[i]);
     g_free(def->disks);
@@ -360,13 +360,13 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
                          "disk-only snapshot"));
         goto cleanup;
     }
-    def->file = g_steal_pointer(&memoryFile);
+    def->memorysnapshotfile = g_steal_pointer(&memoryFile);

     /* verify that memory path is absolute */
-    if (def->file && !g_path_is_absolute(def->file)) {
+    if (def->memorysnapshotfile && !g_path_is_absolute(def->memorysnapshotfile)) {
         virReportError(VIR_ERR_XML_ERROR,
                        _("memory snapshot file path (%s) must be absolute"),
-                       def->file);
+                       def->memorysnapshotfile);
         goto cleanup;
     }

@@ -863,7 +863,7 @@ virDomainSnapshotDefFormatInternal(virBuffer *buf,
     if (def->memory) {
         virBufferAsprintf(buf, "<memory snapshot='%s'",
                           virDomainSnapshotLocationTypeToString(def->memory));
-        virBufferEscapeString(buf, " file='%s'", def->file);
+        virBufferEscapeString(buf, " file='%s'", def->memorysnapshotfile);
         virBufferAddLit(buf, "/>\n");
     }

diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index 7d49a555cd..a3ec0cd410 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -82,7 +82,7 @@ struct _virDomainSnapshotDef {
     int state; /* virDomainSnapshotState */

     int memory; /* virDomainMemorySnapshot */
-    char *file; /* memory state file when snapshot is external */
+    char *memorysnapshotfile; /* memory state file when snapshot is external */

     size_t ndisks; /* should not exceed dom->ndisks */
     virDomainSnapshotDiskDef *disks;
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index dab386e455..99fc4b836f 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1451,9 +1451,9 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
             goto cleanup;
         xml = NULL;

-        if ((ret = qemuSaveImageCreate(driver, vm, snapdef->file, data,
-                                      compressor, 0,
-                                      QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
+        if ((ret = qemuSaveImageCreate(driver, vm, snapdef->memorysnapshotfile,
+                                       data, compressor, 0,
+                                       QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
             goto cleanup;

         /* the memory image was created, remove it on errors */
@@ -1522,7 +1522,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,

     virQEMUSaveDataFree(data);
     if (memory_unlink && ret < 0)
-        unlink(snapdef->file);
+        unlink(snapdef->memorysnapshotfile);

     return ret;
 }
-- 
2.31.1




More information about the libvir-list mailing list