[PATCH 2/7] virStorageSourceUpdateCapacity: Drop 'probe' argument

Peter Krempa pkrempa at redhat.com
Fri Feb 21 13:51:40 UTC 2020


Both callers pass false. Since we frown upon format probing, remove the
unused possibility to do the probing.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_driver.c     |  2 +-
 src/storage/storage_util.c |  2 +-
 src/util/virstoragefile.c  | 23 ++++++-----------------
 src/util/virstoragefile.h  |  3 +--
 4 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 39e1f044e0..943caea011 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12269,7 +12269,7 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver,
     if (virStorageSourceUpdateBackingSizes(src, fd, &sb) < 0)
         goto cleanup;

-    if (virStorageSourceUpdateCapacity(src, buf, len, false) < 0)
+    if (virStorageSourceUpdateCapacity(src, buf, len) < 0)
         goto cleanup;

     /* If guest is not using raw disk format and is on a host block
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index c2754dbb93..8199c7a2af 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1756,7 +1756,7 @@ storageBackendUpdateVolTargetInfo(virStorageVolType voltype,
             }
         }

-        if (virStorageSourceUpdateCapacity(target, buf, len, false) < 0)
+        if (virStorageSourceUpdateCapacity(target, buf, len) < 0)
             return -1;
     }

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index b984204b93..cc351e3f53 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -3964,18 +3964,15 @@ virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
  * @src: disk source definition structure
  * @buf: buffer to the storage file header
  * @len: length of the storage file header
- * @probe: allow probe
  *
- * Update the storage @src capacity. This may involve probing the storage
- * @src in order to "see" if we can recognize what exists.
+ * Update the storage @src capacity.
  *
  * Returns 0 on success, -1 on error.
  */
 int
 virStorageSourceUpdateCapacity(virStorageSourcePtr src,
                                char *buf,
-                               ssize_t len,
-                               bool probe)
+                               ssize_t len)
 {
     int format = src->format;
     g_autoptr(virStorageSource) meta = NULL;
@@ -3984,18 +3981,10 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
      * the metadata has a capacity, use that, otherwise fall back to
      * physical size.  */
     if (format == VIR_STORAGE_FILE_NONE) {
-        if (!probe) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("no disk format for %s and probing is disabled"),
-                           src->path);
-            return -1;
-        }
-
-        if ((format = virStorageFileProbeFormatFromBuf(src->path,
-                                                       buf, len)) < 0)
-            return -1;
-
-        src->format = format;
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("no disk format for %s was specified"),
+                       src->path);
+        return -1;
     }

     if (format == VIR_STORAGE_FILE_RAW && !src->encryption) {
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 1f41e6e357..2a684fd746 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -472,8 +472,7 @@ int virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
 int virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
                                        int fd, struct stat const *sb);
 int virStorageSourceUpdateCapacity(virStorageSourcePtr src,
-                                   char *buf, ssize_t len,
-                                   bool probe);
+                                   char *buf, ssize_t len);

 int virStorageSourceNewFromBacking(virStorageSourcePtr parent,
                                    virStorageSourcePtr *backing);
-- 
2.24.1




More information about the libvir-list mailing list