block: qemu-iotests, fix _make_test_img() to work with spaced pathnames
_make_test_img() currently works with spaced pathnames only when not specifying a backing file. This fixes it so that the backing file argument is properly quoted. Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
		
							parent
							
								
									0084043888
								
							
						
					
					
						commit
						0018c03f5d
					
				@ -111,6 +111,8 @@ _make_test_img()
 | 
				
			|||||||
    local image_size=$*
 | 
					    local image_size=$*
 | 
				
			||||||
    local optstr=""
 | 
					    local optstr=""
 | 
				
			||||||
    local img_name=""
 | 
					    local img_name=""
 | 
				
			||||||
 | 
					    local use_backing=0
 | 
				
			||||||
 | 
					    local backing_file=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ -n "$TEST_IMG_FILE" ]; then
 | 
					    if [ -n "$TEST_IMG_FILE" ]; then
 | 
				
			||||||
        img_name=$TEST_IMG_FILE
 | 
					        img_name=$TEST_IMG_FILE
 | 
				
			||||||
@ -123,7 +125,8 @@ _make_test_img()
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ "$1" = "-b" ]; then
 | 
					    if [ "$1" = "-b" ]; then
 | 
				
			||||||
        extra_img_options="$1 $2"
 | 
					        use_backing=1
 | 
				
			||||||
 | 
					        backing_file=$2
 | 
				
			||||||
        image_size=$3
 | 
					        image_size=$3
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
 | 
					    if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
 | 
				
			||||||
@ -135,7 +138,13 @@ _make_test_img()
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # XXX(hch): have global image options?
 | 
					    # XXX(hch): have global image options?
 | 
				
			||||||
    $QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size 2>&1 | \
 | 
					    (
 | 
				
			||||||
 | 
					     if [ $use_backing = 1 ]; then
 | 
				
			||||||
 | 
					        $QEMU_IMG create -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" $image_size 2>&1
 | 
				
			||||||
 | 
					     else
 | 
				
			||||||
 | 
					        $QEMU_IMG create -f $IMGFMT $extra_img_options "$img_name" $image_size 2>&1
 | 
				
			||||||
 | 
					     fi
 | 
				
			||||||
 | 
					    ) | \
 | 
				
			||||||
        sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
 | 
					        sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
 | 
				
			||||||
            -e "s#$TEST_DIR#TEST_DIR#g" \
 | 
					            -e "s#$TEST_DIR#TEST_DIR#g" \
 | 
				
			||||||
            -e "s#$IMGFMT#IMGFMT#g" \
 | 
					            -e "s#$IMGFMT#IMGFMT#g" \
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user