render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From f27731da867f6a0784c1f2a222d5b7663c418784 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <f27731da867f6a0784c1f2a222d5b7663c418784@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Fri, 28 Feb 2020 10:24:36 +0100
a41c76
Subject: [PATCH] virStorageSourceUpdateCapacity: Drop 'probe' argument
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Both callers pass false. Since we frown upon format probing, remove the
a41c76
unused possibility to do the probing.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 35d1f5bd145163edf4f05c377b488ffa50d527d6)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
a41c76
Message-Id: <c2cfa21552eee3b2cfca74096dfe9d301bbf4e61.1582881363.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_driver.c     |  2 +-
a41c76
 src/storage/storage_util.c |  2 +-
a41c76
 src/util/virstoragefile.c  | 23 ++++++-----------------
a41c76
 src/util/virstoragefile.h  |  3 +--
a41c76
 4 files changed, 9 insertions(+), 21 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
a41c76
index ac3a7ad282..d346446444 100644
a41c76
--- a/src/qemu/qemu_driver.c
a41c76
+++ b/src/qemu/qemu_driver.c
a41c76
@@ -12221,7 +12221,7 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver,
a41c76
     if (virStorageSourceUpdateBackingSizes(src, fd, &sb) < 0)
a41c76
         goto cleanup;
a41c76
 
a41c76
-    if (virStorageSourceUpdateCapacity(src, buf, len, false) < 0)
a41c76
+    if (virStorageSourceUpdateCapacity(src, buf, len) < 0)
a41c76
         goto cleanup;
a41c76
 
a41c76
     /* If guest is not using raw disk format and is on a host block
a41c76
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
a41c76
index ebc262278d..c562cf313f 100644
a41c76
--- a/src/storage/storage_util.c
a41c76
+++ b/src/storage/storage_util.c
a41c76
@@ -1755,7 +1755,7 @@ storageBackendUpdateVolTargetInfo(virStorageVolType voltype,
a41c76
             }
a41c76
         }
a41c76
 
a41c76
-        if (virStorageSourceUpdateCapacity(target, buf, len, false) < 0)
a41c76
+        if (virStorageSourceUpdateCapacity(target, buf, len) < 0)
a41c76
             return -1;
a41c76
     }
a41c76
 
a41c76
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
a41c76
index 5a74034ec4..391e2ce86f 100644
a41c76
--- a/src/util/virstoragefile.c
a41c76
+++ b/src/util/virstoragefile.c
a41c76
@@ -3964,18 +3964,15 @@ virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
a41c76
  * @src: disk source definition structure
a41c76
  * @buf: buffer to the storage file header
a41c76
  * @len: length of the storage file header
a41c76
- * @probe: allow probe
a41c76
  *
a41c76
- * Update the storage @src capacity. This may involve probing the storage
a41c76
- * @src in order to "see" if we can recognize what exists.
a41c76
+ * Update the storage @src capacity.
a41c76
  *
a41c76
  * Returns 0 on success, -1 on error.
a41c76
  */
a41c76
 int
a41c76
 virStorageSourceUpdateCapacity(virStorageSourcePtr src,
a41c76
                                char *buf,
a41c76
-                               ssize_t len,
a41c76
-                               bool probe)
a41c76
+                               ssize_t len)
a41c76
 {
a41c76
     int format = src->format;
a41c76
     g_autoptr(virStorageSource) meta = NULL;
a41c76
@@ -3984,18 +3981,10 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
a41c76
      * the metadata has a capacity, use that, otherwise fall back to
a41c76
      * physical size.  */
a41c76
     if (format == VIR_STORAGE_FILE_NONE) {
a41c76
-        if (!probe) {
a41c76
-            virReportError(VIR_ERR_INTERNAL_ERROR,
a41c76
-                           _("no disk format for %s and probing is disabled"),
a41c76
-                           src->path);
a41c76
-            return -1;
a41c76
-        }
a41c76
-
a41c76
-        if ((format = virStorageFileProbeFormatFromBuf(src->path,
a41c76
-                                                       buf, len)) < 0)
a41c76
-            return -1;
a41c76
-
a41c76
-        src->format = format;
a41c76
+        virReportError(VIR_ERR_INTERNAL_ERROR,
a41c76
+                       _("no disk format for %s was specified"),
a41c76
+                       src->path);
a41c76
+        return -1;
a41c76
     }
a41c76
 
a41c76
     if (format == VIR_STORAGE_FILE_RAW && !src->encryption) {
a41c76
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
a41c76
index 1f41e6e357..2a684fd746 100644
a41c76
--- a/src/util/virstoragefile.h
a41c76
+++ b/src/util/virstoragefile.h
a41c76
@@ -472,8 +472,7 @@ int virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
a41c76
 int virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
a41c76
                                        int fd, struct stat const *sb);
a41c76
 int virStorageSourceUpdateCapacity(virStorageSourcePtr src,
a41c76
-                                   char *buf, ssize_t len,
a41c76
-                                   bool probe);
a41c76
+                                   char *buf, ssize_t len);
a41c76
 
a41c76
 int virStorageSourceNewFromBacking(virStorageSourcePtr parent,
a41c76
                                    virStorageSourcePtr *backing);
a41c76
-- 
a41c76
2.25.1
a41c76