summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinayak Papnoi <vpapnoi@redhat.com>2019-07-23 20:07:34 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2020-01-16 06:23:46 +0000
commit29bf87afc6e84f53a21969590c513bab6aeba627 (patch)
tree43e4c0df273780fe9fd05452f67840b171642d23
parentd0aee85958ff13d15eaf75468fe9af0698b06f2e (diff)
[Shared storage] Fix library function
The library shared_storage_ops.py contains two functions which are similar and do not serve a completely unique purpose. These functions are "is_shared_volume_mounted" and "is_shared_volume_unmounted". Here, the function "is_shared_volume_unmounted" needs to be removed because any test case can be validated using assertion for the function "is_shared_volume_mounted". The function "disable_shared_storage" has an incorrect description. This description has been changed with the fix. There are minor cosmetic changes as well which have been fixed to make the code lightweight. Change-Id: I796831a95c205fef49a841eb14f5a15079f9a6b0 Signed-off-by: Vinayak Papnoi <vpapnoi@redhat.com>
-rw-r--r--glustolibs-gluster/glustolibs/gluster/shared_storage_ops.py38
1 files changed, 6 insertions, 32 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/shared_storage_ops.py b/glustolibs-gluster/glustolibs/gluster/shared_storage_ops.py
index 3ea3c97..b1cf703 100644
--- a/glustolibs-gluster/glustolibs/gluster/shared_storage_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/shared_storage_ops.py
@@ -47,7 +47,7 @@ def enable_shared_storage(mnode):
def disable_shared_storage(mnode):
"""
- Enables the shared storage
+ Disables the shared storage
Args:
mnode (str) : Node on which command is to be executed
@@ -61,19 +61,19 @@ def disable_shared_storage(mnode):
if not ret:
g.log.error("Failed to disable shared storage")
return False
- g.log.info("Successfully disabled shared storage option")
+ g.log.info("Successfully disabled shared storage")
return True
def is_shared_volume_mounted(mnode):
"""
- Checks shared volume mounted after enabling it
+ Checks if shared storage volume is mounted
Args:
mnode (str) : Node on which command is to be executed
Returns:
- bool : True if successfully mounted shared volume.
+ bool : True if shared storage volume is mounted.
False otherwise.
"""
halt = 20
@@ -82,38 +82,12 @@ def is_shared_volume_mounted(mnode):
while counter < halt:
_, out, _ = g.run(mnode, "df -h")
if path in out:
- g.log.info("Shared volume mounted successfully")
- return True
- else:
- sleep(2)
- counter = counter + 2
- g.log.error("Shared volume not mounted")
- return False
-
-
-def is_shared_volume_unmounted(mnode):
- """
- Checks shared volume unmounted after disabling it
-
- Args:
- mnode (str) : Node on which command is to be executed
-
- Returns:
- bool : True if successfully unmounted shared volume.
- False otherwise.
- """
- halt = 20
- counter = 0
- path = "/run/gluster/shared_storage"
- while counter < halt:
- _, out, _ = g.run(mnode, "df -h")
- if path not in out:
- g.log.info("Shared volume unmounted successfully")
+ g.log.info("Shared storage volume is mounted")
return True
else:
sleep(2)
counter = counter + 2
- g.log.error("Shared volume not unmounted")
+ g.log.info("Shared storage volume not mounted")
return False