aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/qcow2.py
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-04-23 14:27:04 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-04-23 14:27:04 -0500
commit1f8bcac09af61e58c5121aa0a932190700ad554d (patch)
tree4bb240289095295eb5b3806d6347cd866a55a542 /tests/qemu-iotests/qcow2.py
parentcb4c2548ea7cceef7260465773c6b8e634c186d4 (diff)
parent1042ec94b19e0bfaae74c912ebbdfdbff8dd7db2 (diff)
Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony: (38 commits) qemu-iotests: Fix test 031 for qcow2 v3 support qemu-iotests: Add -o and make v3 the default for qcow2 qcow2: Zero write support qemu-iotests: Test backing file COW with zero clusters qemu-iotests: add a simple test for write_zeroes qcow2: Support for feature table header extension qcow2: Support reading zero clusters qcow2: Version 3 images qcow2: Ignore reserved bits in check_refcounts qcow2: Ignore reserved bits in refcount table entries qcow2: Simplify count_cow_clusters qcow2: Refactor qcow2_free_any_clusters qcow2: Ignore reserved bits in L1/L2 entries qcow2: Fail write_compressed when overwriting data qcow2: Ignore reserved bits in count_contiguous_clusters() qcow2: Ignore reserved bits in get_cluster_offset qcow2: Save disk size in snapshot header Specification for qcow2 version 3 qcow2: Fix refcount block allocation during qcow2_alloc_cluster_at() iotests: Resolve test failures caused by hostname ...
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)