Blame SOURCES/libvirt-virStorageBackendGlusterRefreshVol-Refactor-handling-of-backing-store.patch

d76c62
From 315706837bdb6f11c0bb4b48612d35afa1965454 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <315706837bdb6f11c0bb4b48612d35afa1965454@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Fri, 28 Feb 2020 10:24:39 +0100
d76c62
Subject: [PATCH] virStorageBackendGlusterRefreshVol: Refactor handling of
d76c62
 backing store
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Take the format of the backing store from the 'meta' object directly and
d76c62
use g_steal_pointer to steal the path.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit fee56942e2dacc64ed4b36aa2ea887f60c117659)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
d76c62
Message-Id: <8bf19c252bd0a49ef7e689c809314345d7831735.1582881363.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/storage/storage_backend_gluster.c | 11 ++++-------
d76c62
 1 file changed, 4 insertions(+), 7 deletions(-)
d76c62
d76c62
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
d76c62
index 4a8ee3870d..e92e9612bd 100644
d76c62
--- a/src/storage/storage_backend_gluster.c
d76c62
+++ b/src/storage/storage_backend_gluster.c
d76c62
@@ -224,7 +224,6 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
d76c62
     int ret = -1;
d76c62
     glfs_fd_t *fd = NULL;
d76c62
     ssize_t len;
d76c62
-    int backingFormat;
d76c62
     g_autoptr(virStorageVolDef) vol = NULL;
d76c62
     g_autoptr(virStorageSource) meta = NULL;
d76c62
     g_autofree char *header = NULL;
d76c62
@@ -277,7 +276,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
d76c62
 
d76c62
     if (!(meta = virStorageFileGetMetadataFromBuf(name, header, len,
d76c62
                                                   VIR_STORAGE_FILE_AUTO,
d76c62
-                                                  &backingFormat)))
d76c62
+                                                  NULL)))
d76c62
         goto cleanup;
d76c62
 
d76c62
     if (meta->backingStoreRaw) {
d76c62
@@ -286,13 +285,11 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
d76c62
 
d76c62
         vol->target.backingStore->type = VIR_STORAGE_TYPE_NETWORK;
d76c62
 
d76c62
-        vol->target.backingStore->path = meta->backingStoreRaw;
d76c62
+        vol->target.backingStore->path = g_steal_pointer(&meta->backingStoreRaw);
d76c62
+        vol->target.backingStore->format = meta->backingStoreRawFormat;
d76c62
 
d76c62
-        if (backingFormat < 0)
d76c62
+        if (vol->target.backingStore->format < 0)
d76c62
             vol->target.backingStore->format = VIR_STORAGE_FILE_RAW;
d76c62
-        else
d76c62
-            vol->target.backingStore->format = backingFormat;
d76c62
-        meta->backingStoreRaw = NULL;
d76c62
     }
d76c62
 
d76c62
     vol->target.format = meta->format;
d76c62
-- 
d76c62
2.25.1
d76c62