提交 dfba3704 编写于 作者: D Daniel P. Berrange

Log warning if storage magic matches, but version does not

To help us detect when new storage file versions come into
existance log a warning if the storage file magic matches,
but the version does not
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 f6bd0a88
......@@ -756,16 +756,26 @@ virStorageFileProbeFormatFromBuf(const char *path,
{
int format = VIR_STORAGE_FILE_RAW;
int i;
int possibleFormat = VIR_STORAGE_FILE_RAW;
VIR_DEBUG("path=%s", path);
/* First check file magic */
for (i = 0 ; i < VIR_STORAGE_FILE_LAST ; i++) {
if (virStorageFileMatchesMagic(i, buf, buflen) &&
virStorageFileMatchesVersion(i, buf, buflen)) {
if (virStorageFileMatchesMagic(i, buf, buflen)) {
if (!virStorageFileMatchesVersion(i, buf, buflen)) {
possibleFormat = i;
continue;
}
format = i;
goto cleanup;
}
}
if (possibleFormat != VIR_STORAGE_FILE_RAW)
VIR_WARN("File %s matches %s magic, but version is wrong. "
"Please report new version to libvir-list@redhat.com",
path, virStorageFileFormatTypeToString(possibleFormat));
/* No magic, so check file extension */
for (i = 0 ; i < VIR_STORAGE_FILE_LAST ; i++) {
if (virStorageFileMatchesExtension(i, path)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册