libvirt/SOURCES/libvirt-virStorageSourceUpd...

118 lines
4.5 KiB
Diff

From f27731da867f6a0784c1f2a222d5b7663c418784 Mon Sep 17 00:00:00 2001
Message-Id: <f27731da867f6a0784c1f2a222d5b7663c418784@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 28 Feb 2020 10:24:36 +0100
Subject: [PATCH] virStorageSourceUpdateCapacity: Drop 'probe' argument
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Both callers pass false. Since we frown upon format probing, remove the
unused possibility to do the probing.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 35d1f5bd145163edf4f05c377b488ffa50d527d6)
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
Message-Id: <c2cfa21552eee3b2cfca74096dfe9d301bbf4e61.1582881363.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@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 ac3a7ad282..d346446444 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12221,7 +12221,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 ebc262278d..c562cf313f 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1755,7 +1755,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 5a74034ec4..391e2ce86f 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.25.1