Update read and write data path in cinder test 19/58019/4
authorDelia Popescu <delia.popescu@enea.com>
Tue, 29 May 2018 08:46:37 +0000 (11:46 +0300)
committerDelia Popescu <delia.popescu@enea.com>
Thu, 31 May 2018 08:29:28 +0000 (11:29 +0300)
Update the path for read/write data
Fix a false possitive result on read_data
Fix read device name
Unmount volume after writing data

JIRA: FUNCTEST-908

Change-Id: I555b5a3daaeff3aa58891e65c0b70094372c04c9
Signed-off-by: Delia Popescu <delia.popescu@enea.com>
functest/opnfv_tests/openstack/cinder/read_data.sh
functest/opnfv_tests/openstack/cinder/write_data.sh

index 9075843..c3ce9e4 100644 (file)
@@ -8,14 +8,16 @@
 #
 # http://www.apache.org/licenses/LICENSE-2.0
 
-VOL_DEV_NAME="$(lsblk -l | grep -Po '^[vs]dc\W')"
+DEST=$(mktemp -d)
+VOL_DEV_NAME="$(lsblk -l -o NAME | grep -o "vdc\|sdc\b")"
+echo "VOL_DEV_NAME: $VOL_DEV_NAME"
 
-if [ -n "$VOL_DEV_NAME" ]; then
-    sudo mount /dev/$VOL_DEV_NAME /home/cirros/volume;
-    if [ -f /home/cirros/volume/new_data ]; then
-        echo "Found existing data!";
+if [ ! -z $VOL_DEV_NAME ]; then
+    sudo mount /dev/$VOL_DEV_NAME $DEST
+    if [ -f $DEST/new_data ]; then
+        echo "Found new data!"
     else
-        echo "No data found on the volume!";
-        exit 1
+        echo "Failed to find data!"
+    exit 1
     fi
 fi
index eeafbb5..70f8275 100644 (file)
@@ -8,14 +8,19 @@
 #
 # http://www.apache.org/licenses/LICENSE-2.0
 
-VOL_DEV_NAME="$(lsblk -l | grep -Po '^[vs]dc\W')"
+DEST=$(mktemp -d)
+VOL_DEV_NAME="$(lsblk -l -o NAME | grep -o "vdc\|sdc\b")"
 
-if [ -n $VOL_DEV_NAME ]; then
-    sudo mkdir -p /home/cirros/volume
+echo "VOL_DEV_NAME: $VOL_DEV_NAME"
+
+if [ ! -z $VOL_DEV_NAME ]; then
     sudo /usr/sbin/mkfs.ext4 -F /dev/$VOL_DEV_NAME
-    sudo mount /dev/$VOL_DEV_NAME /home/cirros/volume
-    sudo touch /home/cirros/volume/new_data
-    echo "New data added to the volume!"
+    sudo mount /dev/$VOL_DEV_NAME $DEST
+    sudo touch $DEST/new_data
+    if [ -f $DEST/new_data ]; then
+        echo "New data added to the volume!"
+        sudo umount $DEST
+    fi
 else
     echo "Failed to write data!"
     exit 1