From: Kevin Wolf Date: Tue, 25 Nov 2014 17:12:41 +0000 (+0100) Subject: qcow2.py: Add required padding for header extensions X-Git-Tag: qemu-xen-4.6.0-rc1~34^2~39 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9f8da0319dfc321abe98b6454e7970015ac4e23c;p=qemu-upstream-4.6-testing.git 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 Reviewed-by: Max Reitz Message-id: 1416935562-7760-3-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf (cherry picked from commit 8884dd1bbc5ce42cd657ffcbef3a477443468974) Signed-off-by: Michael Roth --- diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py index 205859696..9cc4cf7d0 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