mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
8900436891
commit
1042ec94b1
3 changed files with 172 additions and 26 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue