summaryrefslogtreecommitdiffstats
path: root/tests/functional/heketi
diff options
context:
space:
mode:
authorNitin Goyal <nigoyal@redhat.com>2020-12-02 12:14:44 +0530
committerNitin Goyal <nigoyal@redhat.com>2020-12-08 19:49:10 +0530
commit5824364e65321851730b6955b0dd5eec4b8dd04f (patch)
tree009c8676a142c0ab79e266aee7beb3f16ac256e7 /tests/functional/heketi
parent9377e7d2eb32408046e01c5d02794f1a4019eba8 (diff)
[Test] Add test test_block_vol_online_expand
The test verifies block volume expand feature works and reflecting new size in client side. Change-Id: Id3dd1d75b99fd8607ed97db53ad1912a4441ab02 Signed-off-by: Nitin Goyal <nigoyal@redhat.com>
Diffstat (limited to 'tests/functional/heketi')
-rw-r--r--tests/functional/heketi/test_block_volumes_heketi.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/functional/heketi/test_block_volumes_heketi.py b/tests/functional/heketi/test_block_volumes_heketi.py
index 8c909981..f56ead9c 100644
--- a/tests/functional/heketi/test_block_volumes_heketi.py
+++ b/tests/functional/heketi/test_block_volumes_heketi.py
@@ -47,6 +47,10 @@ from openshiftstoragelibs.openshift_ops import (
scale_dc_pod_amount_and_wait,
wait_for_service_status_on_gluster_pod_or_node,
)
+from openshiftstoragelibs.openshift_storage_libs import (
+ get_iscsi_block_devices_by_path,
+ get_mpath_name_from_device_name,
+)
from openshiftstoragelibs import podcmd
from openshiftstoragelibs import waiter
from openshiftstoragelibs import utils
@@ -665,3 +669,52 @@ class TestBlockVolumeOps(GlusterBlockBaseClass):
self.assertEqual(
int(float(size)), bvol_info["size"], "new size is not "
"reflected at mount point after block volume expand")
+
+ @pytest.mark.tier1
+ def test_block_vol_online_expand(self):
+ """Test blockvol expansion while PVC is in use"""
+ node = self.ocp_master_node[0]
+
+ pvc_name, dc_name, bvol_info = (
+ self._block_vol_expand_common_offline_vs_online(True))
+
+ # get pod hostname
+ iqn, _, pod_hostname = self.verify_iscsi_sessions_and_multipath(
+ pvc_name, dc_name[0])
+
+ # Get the paths info from the node
+ device = list(
+ get_iscsi_block_devices_by_path(pod_hostname, iqn).keys())[0]
+
+ # Get mpath name
+ mpath = get_mpath_name_from_device_name(pod_hostname, device)
+
+ # rescan the devices on pod_hostname
+ cmd = "iscsiadm -m node -R -T {}".format(iqn)
+ self.cmd_run(cmd, pod_hostname)
+
+ # refresh multipath device size
+ cmd = "multipathd -k'resize map {}'".format(mpath)
+ self.cmd_run(cmd, pod_hostname)
+
+ # get mount point
+ cmd = "lsblk /dev/{} --output MOUNTPOINT --noheadings".format(device)
+ mount_point = self.cmd_run(cmd, pod_hostname)
+
+ cmd = "xfs_growfs {}".format(mount_point)
+ self.cmd_run(cmd, pod_hostname)
+
+ cmd = ("df -h {} | sed '/Filesystem/d' | awk '{{print $2}}' |"
+ " sed 's/G//'")
+ size = self.cmd_run(cmd.format(mount_point), pod_hostname)
+ self.assertEqual(
+ int(float(size)), bvol_info["size"], "new size is not "
+ "reflected at host mount point after block volume expand")
+
+ # verify expand size
+ pod_name = get_pod_name_from_dc(node, dc_name[0])
+ ret, size, _ = oc_rsh(node, pod_name, cmd.format("/mnt"))
+ self.assertFalse(ret, "Failed to get size from client side")
+ self.assertEqual(
+ int(float(size)), bvol_info["size"], "new size is not "
+ "reflected at mount point after block volume expand")