Commit ae0c0a3d authored by Ashish Mittal's avatar Ashish Mittal Committed by Jeff Cody
Browse files

block/vxhs.c: Add qemu-iotests for new block device type "vxhs"

These changes use a vxhs test server that is a part of the following
repository:
https://github.com/VeritasHyperScale/libqnio.git



Signed-off-by: default avatarAshish Mittal <Ashish.Mittal@veritas.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: default avatarJeff Cody <jcody@redhat.com>
Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
Message-id: 1491277689-24949-3-git-send-email-Ashish.Mittal@veritas.com
parent da92c3ff
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@ check options
    -ssh                test ssh
    -nfs                test nfs
    -luks               test luks
    -vxhs               test vxhs
    -xdiff              graphical mode diff
    -nocache            use O_DIRECT on backing file
    -misalign           misalign memory allocations
@@ -260,6 +261,11 @@ testlist options
            xpand=false
            ;;

        -vxhs)
            IMGPROTO=vxhs
            xpand=false
            ;;

        -ssh)
            IMGPROTO=ssh
            xpand=false
+13 −0
Original line number Diff line number Diff line
@@ -105,6 +105,10 @@ if [ -z "$QEMU_NBD_PROG" ]; then
    export QEMU_NBD_PROG="`set_prog_path qemu-nbd`"
fi

if [ -z "$QEMU_VXHS_PROG" ]; then
    export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
fi

_qemu_wrapper()
{
    (
@@ -156,10 +160,19 @@ _qemu_nbd_wrapper()
    )
}

_qemu_vxhs_wrapper()
{
    (
        echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid"
        exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@"
    )
}

export QEMU=_qemu_wrapper
export QEMU_IMG=_qemu_img_wrapper
export QEMU_IO=_qemu_io_wrapper
export QEMU_NBD=_qemu_nbd_wrapper
export QEMU_VXHS=_qemu_vxhs_wrapper

QEMU_IMG_EXTRA_ARGS=
if [ "$IMGOPTSSYNTAX" = "true" ]; then
+1 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ _filter_img_info()
        -e "s#$TEST_DIR#TEST_DIR#g" \
        -e "s#$IMGFMT#IMGFMT#g" \
        -e 's#nbd://127.0.0.1:10810$#TEST_DIR/t.IMGFMT#g' \
        -e 's#json.*vdisk-id.*vxhs"}}#TEST_DIR/t.IMGFMT#' \
        -e "/encrypted: yes/d" \
        -e "/cluster_size: [0-9]\\+/d" \
        -e "/table_size: [0-9]\\+/d" \
+19 −0
Original line number Diff line number Diff line
@@ -85,6 +85,9 @@ else
    elif [ "$IMGPROTO" = "nfs" ]; then
        TEST_DIR="nfs://127.0.0.1/$TEST_DIR"
        TEST_IMG=$TEST_DIR/t.$IMGFMT
    elif [ "$IMGPROTO" = "vxhs" ]; then
        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
        TEST_IMG="vxhs://127.0.0.1:9999/t.$IMGFMT"
    else
        TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
    fi
@@ -171,6 +174,12 @@ _make_test_img()
        eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 -f $IMGFMT  $TEST_IMG_FILE >/dev/null &"
        sleep 1 # FIXME: qemu-nbd needs to be listening before we continue
    fi

    # Start QNIO server on image directory for vxhs protocol
    if [ $IMGPROTO = "vxhs" ]; then
        eval "$QEMU_VXHS -d  $TEST_DIR > /dev/null &"
        sleep 1 # Wait for server to come up.
    fi
}

_rm_test_img()
@@ -197,6 +206,16 @@ _cleanup_test_img()
            fi
            rm -f "$TEST_IMG_FILE"
            ;;
        vxhs)
            if [ -f "${TEST_DIR}/qemu-vxhs.pid" ]; then
                local QEMU_VXHS_PID
                read QEMU_VXHS_PID < "${TEST_DIR}/qemu-vxhs.pid"
                kill ${QEMU_VXHS_PID} >/dev/null 2>&1
                rm -f "${TEST_DIR}/qemu-vxhs.pid"
            fi
            rm -f "$TEST_IMG_FILE"
            ;;

        file)
            _rm_test_img "$TEST_DIR/t.$IMGFMT"
            _rm_test_img "$TEST_DIR/t.$IMGFMT.orig"