summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-11-25 18:12:41 +0100
committerKevin Wolf <kwolf@redhat.com>2014-12-10 10:31:13 +0100
commit8884dd1bbc5ce42cd657ffcbef3a477443468974 (patch)
tree31f8ce06f9ea2d81c36517d03d41f517d658f956 /tests
parent2ebafc854d109ff09b66fb4dd62c2c53fc29754a (diff)
downloadqemu-8884dd1bbc5ce42cd657ffcbef3a477443468974.tar.gz
qcow2.py: Add required padding for header extensions
The qcow2 specification requires that the header extension data be padded to round up the extension size to the next multiple of 8 bytes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 1416935562-7760-3-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/qcow2.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index 2058596964..9cc4cf7d08 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -7,6 +7,10 @@ import string
class QcowHeaderExtension:
def __init__(self, magic, length, data):
+ if length % 8 != 0:
+ padding = 8 - (length % 8)
+ data += "\0" * padding
+
self.magic = magic
self.length = length
self.data = data