yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-qemu-iotests-fix-_make_test_img-to-work-with-s.patch

0a122b
From 2235c9a514307669f458b5490f127c6e11989a99 Mon Sep 17 00:00:00 2001
0a122b
From: Jeffrey Cody <jcody@redhat.com>
0a122b
Date: Wed, 20 Nov 2013 19:43:46 +0100
0a122b
Subject: [PATCH 03/25] block: qemu-iotests, fix _make_test_img() to work with spaced pathnames
0a122b
0a122b
RH-Author: Jeffrey Cody <jcody@redhat.com>
0a122b
Message-id: <4c889b5de385100b5406f2cab6dfffd04936e666.1384975172.git.jcody@redhat.com>
0a122b
Patchwork-id: 55796
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 03/26] block: qemu-iotests, fix _make_test_img() to work with spaced pathnames
0a122b
Bugzilla: 879234
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
0a122b
_make_test_img() currently works with spaced pathnames only when not
0a122b
specifying a backing file.  This fixes it so that the backing file
0a122b
argument is properly quoted.
0a122b
0a122b
Signed-off-by: Jeff Cody <jcody@redhat.com>
0a122b
Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
(cherry picked from commit 0018c03f5d37f3a7df23eef0e9f1e6e6189ed634)
0a122b
---
0a122b
 tests/qemu-iotests/common.rc | 13 +++++++++++--
0a122b
 1 file changed, 11 insertions(+), 2 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/common.rc |   13 +++++++++++--
0a122b
 1 files changed, 11 insertions(+), 2 deletions(-)
0a122b
0a122b
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
0a122b
index 4e82604..d24de2c 100644
0a122b
--- a/tests/qemu-iotests/common.rc
0a122b
+++ b/tests/qemu-iotests/common.rc
0a122b
@@ -111,6 +111,8 @@ _make_test_img()
0a122b
     local image_size=$*
0a122b
     local optstr=""
0a122b
     local img_name=""
0a122b
+    local use_backing=0
0a122b
+    local backing_file=""
0a122b
 
0a122b
     if [ -n "$TEST_IMG_FILE" ]; then
0a122b
         img_name=$TEST_IMG_FILE
0a122b
@@ -123,7 +125,8 @@ _make_test_img()
0a122b
     fi
0a122b
 
0a122b
     if [ "$1" = "-b" ]; then
0a122b
-        extra_img_options="$1 $2"
0a122b
+        use_backing=1
0a122b
+        backing_file=$2
0a122b
         image_size=$3
0a122b
     fi
0a122b
     if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
0a122b
@@ -135,7 +138,13 @@ _make_test_img()
0a122b
     fi
0a122b
 
0a122b
     # XXX(hch): have global image options?
0a122b
-    $QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size 2>&1 | \
0a122b
+    (
0a122b
+     if [ $use_backing = 1 ]; then
0a122b
+        $QEMU_IMG create -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" $image_size 2>&1
0a122b
+     else
0a122b
+        $QEMU_IMG create -f $IMGFMT $extra_img_options "$img_name" $image_size 2>&1
0a122b
+     fi
0a122b
+    ) | \
0a122b
         sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
0a122b
             -e "s#$TEST_DIR#TEST_DIR#g" \
0a122b
             -e "s#$IMGFMT#IMGFMT#g" \
0a122b
-- 
0a122b
1.7.1
0a122b