render / rpms / libvirt

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