summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/opnfv_tests/openstack/cinder/read_data.sh16
-rw-r--r--functest/opnfv_tests/openstack/cinder/write_data.sh17
2 files changed, 20 insertions, 13 deletions
diff --git a/functest/opnfv_tests/openstack/cinder/read_data.sh b/functest/opnfv_tests/openstack/cinder/read_data.sh
index 90758436d..c3ce9e4f7 100644
--- a/functest/opnfv_tests/openstack/cinder/read_data.sh
+++ b/functest/opnfv_tests/openstack/cinder/read_data.sh
@@ -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
diff --git a/functest/opnfv_tests/openstack/cinder/write_data.sh b/functest/opnfv_tests/openstack/cinder/write_data.sh
index eeafbb54a..70f8275f1 100644
--- a/functest/opnfv_tests/openstack/cinder/write_data.sh
+++ b/functest/opnfv_tests/openstack/cinder/write_data.sh
@@ -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