Re: [PATCH 3/3] Fix probing of QED file format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/13/12 15:26, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

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: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
  src/util/storage_file.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 69a66ff..c0bb977 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -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,12 @@ virStorageFileMatchesVersion(int format,
      if (fileTypeInfo[format].versionOffset == -1)
          return false;

+    /* -2 == non-versioned file format, so trivially match */
+    if (fileTypeInfo[format].versionOffset == -2) {
+        VIR_WARN("Non-versioned file matches");

Are you sure you want to log this as a warning? Since we know that this file is unversioned do we need to spam the user's log with that?

+        return true;
+    }
+
      if ((fileTypeInfo[format].versionOffset + 4) > buflen)
          return false;



--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]