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

Fix probing of QED file format

The QED file format is non-versioned, so although the magic
value matched, libvirt rejected it due to lack of a version
number to compare against. We need to distinguish this case
by allowing a value of '-2' to indicate a non-versioned file
where only the magic is required to match
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 24643c78
......@@ -174,8 +174,8 @@ static struct FileTypeInfo const fileTypeInfo[] = {
},
[VIR_STORAGE_FILE_QED] = {
/* http://wiki.qemu.org/Features/QED */
"QED\0", NULL,
LV_LITTLE_ENDIAN, -1, -1,
"QED", NULL,
LV_LITTLE_ENDIAN, -2, -1,
QED_HDR_IMAGE_SIZE, 8, 1, -1, qedGetBackingStore,
},
[VIR_STORAGE_FILE_VMDK] = {
......@@ -612,6 +612,10 @@ virStorageFileMatchesVersion(int format,
if (fileTypeInfo[format].versionOffset == -1)
return false;
/* -2 == non-versioned file format, so trivially match */
if (fileTypeInfo[format].versionOffset == -2)
return true;
if ((fileTypeInfo[format].versionOffset + 4) > buflen)
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册