summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/qcow2.py
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2012-04-12 17:21:44 +0200
committerKevin Wolf <kwolf@redhat.com>2012-04-20 15:57:30 +0200
commit1042ec94b19e0bfaae74c912ebbdfdbff8dd7db2 (patch)
treec95feb530ce051affd4c98e589b3b2e9fe3cafaf /tests/qemu-iotests/qcow2.py
parent8900436891cd8955b0795945aa020c04eaa0e5d2 (diff)
downloadqemu-1042ec94b19e0bfaae74c912ebbdfdbff8dd7db2.tar.gz
qemu-iotests: Fix test 031 for qcow2 v3 support
qcow2.py must be updated to work with version 3 images at all, the output has changed since the feature table extension has been added, and version 2 and version 3 images can't possibly have the same test output. Change the test case to completely ignore IMGOPTS and run the test for both compat=1.1 and compat=0.10 regardless of the ./check command line. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/qcow2.py')
-rwxr-xr-xtests/qemu-iotests/qcow2.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index bfb47e88fc..e27196aa26 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -35,6 +35,13 @@ class QcowHeader:
[ uint32_t, '%d', 'refcount_table_clusters' ],
[ uint32_t, '%d', 'nb_snapshots' ],
[ uint64_t, '%#x', 'snapshot_offset' ],
+
+ # Version 3 header fields
+ [ uint64_t, '%#x', 'incompatible_features' ],
+ [ uint64_t, '%#x', 'compatible_features' ],
+ [ uint64_t, '%#x', 'autoclear_features' ],
+ [ uint32_t, '%d', 'refcount_order' ],
+ [ uint32_t, '%d', 'header_length' ],
];
fmt = '>' + ''.join(field[0] for field in fields)
@@ -50,9 +57,10 @@ class QcowHeader:
self.__dict__ = dict((field[2], header[i])
for i, field in enumerate(QcowHeader.fields))
+ self.set_defaults()
self.cluster_size = 1 << self.cluster_bits
- fd.seek(self.get_header_length())
+ fd.seek(self.header_length)
self.load_extensions(fd)
if self.backing_file_offset:
@@ -61,11 +69,13 @@ class QcowHeader:
else:
self.backing_file = None
- def get_header_length(self):
+ def set_defaults(self):
if self.version == 2:
- return 72
- else:
- raise Exception("version != 2 not supported")
+ self.incompatible_features = 0
+ self.compatible_features = 0
+ self.autoclear_features = 0
+ self.refcount_order = 4
+ self.header_length = 72
def load_extensions(self, fd):
self.extensions = []
@@ -86,7 +96,7 @@ class QcowHeader:
def update_extensions(self, fd):
- fd.seek(self.get_header_length())
+ fd.seek(self.header_length)
extensions = self.extensions
extensions.append(QcowHeaderExtension(0, 0, ""))
for ex in extensions:
@@ -103,7 +113,7 @@ class QcowHeader:
def update(self, fd):
- header_bytes = self.get_header_length()
+ header_bytes = self.header_length
self.update_extensions(fd)