render / rpms / libvirt

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