summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2018-06-01 10:29:45 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-06-01 10:29:45 +0000
commit330cd756ea8ba57755655143bce08f9200baf056 (patch)
tree5699d3976fb23e805de892ce9b5ecc1502830364
parent08ecefa38aad23e42f3c2f2039cdcbaeccc2761c (diff)
parent82a755f683b17204b84e0b5966e87e2007a48421 (diff)
Merge "Update read and write data path in cinder test"
-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