提交 35d1f5bd 编写于 作者: P Peter Krempa

virStorageSourceUpdateCapacity: Drop 'probe' argument

Both callers pass false. Since we frown upon format probing, remove the
unused possibility to do the probing.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e5c8f6e0
......@@ -11894,7 +11894,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
......
......@@ -1756,7 +1756,7 @@ storageBackendUpdateVolTargetInfo(virStorageVolType voltype,
}
}
if (virStorageSourceUpdateCapacity(target, buf, len, false) < 0)
if (virStorageSourceUpdateCapacity(target, buf, len) < 0)
return -1;
}
......
......@@ -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) {
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册