thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-qcow2.py-Add-required-padding-for-header-extensions.patch

9ae3a8
From 340c0aaeb771bc3c4b2347e4bcace7afe846907f Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Sat, 13 Jun 2015 16:22:29 +0200
9ae3a8
Subject: [PATCH 35/42] qcow2.py: Add required padding for header extensions
9ae3a8
9ae3a8
Message-id: <1434212556-3927-36-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 66054
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 35/42] qcow2.py: Add required padding for header extensions
9ae3a8
Bugzilla: 1129893
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
9ae3a8
BZ: 1129893
9ae3a8
9ae3a8
The qcow2 specification requires that the header extension data be
9ae3a8
padded to round up the extension size to the next multiple of 8 bytes.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: 1416935562-7760-3-git-send-email-kwolf@redhat.com
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 8884dd1bbc5ce42cd657ffcbef3a477443468974)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/qcow2.py | 4 ++++
9ae3a8
 1 file changed, 4 insertions(+)
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
9ae3a8
index 44a2b45..0e343ef 100755
9ae3a8
--- a/tests/qemu-iotests/qcow2.py
9ae3a8
+++ b/tests/qemu-iotests/qcow2.py
9ae3a8
@@ -7,6 +7,10 @@ import string
9ae3a8
 class QcowHeaderExtension:
9ae3a8
 
9ae3a8
     def __init__(self, magic, length, data):
9ae3a8
+        if length % 8 != 0:
9ae3a8
+            padding = 8 - (length % 8)
9ae3a8
+            data += "\0" * padding
9ae3a8
+
9ae3a8
         self.magic  = magic
9ae3a8
         self.length = length
9ae3a8
         self.data   = data
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8