cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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