diff options
author | Bala Konda Reddy M <bala12352@gmail.com> | 2020-05-18 19:43:59 +0530 |
---|---|---|
committer | Bala Konda Reddy M <bala12352@gmail.com> | 2020-05-18 23:10:08 +0530 |
commit | dd5dbb04312664836e3e2cfc7fc36867d65c6aa7 (patch) | |
tree | 547ce4a403b89d92d67efbdb07fee1fd9876b4e6 /glustolibs-gluster/glustolibs/gluster/gluster_base_class.py | |
parent | f0b1fb7d37843550ad3ab464ebbf20e762227cb1 (diff) |
[Libfix] Add parameter for volume create only
Problem:
Currently setup_volume in volume_libs.py and gluster_base_class.py
are to create volume and start it. There are tests, where only
volume_create is required and if the test has to run on all volume
types. Any contributor have to do all the validations which are
already implemented in setup_volume and classmethod of setup volume
in the gluster_base_class to their test.
Solution:
Added a parameter in the setup_volume() function "create_only" by
default it is false, unless specified this paramter setup_volume
will work as it is.
similarly, have added a parameter in classmethod of setup_volume
in gluster_base_class.py "only_volume_create", here also defaults
to false unless specified.
Note: After calling "setup_volume() -> volume_stop" is not same as
just "volume_create()" in the actual test.
Change-Id: I76cde1b668b3afcac41dd882c2a376cb6fac88a3
Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/gluster_base_class.py')
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/gluster_base_class.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py index 65ecd139a..d27b9ad3e 100644 --- a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py +++ b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py @@ -312,7 +312,7 @@ class GlusterBaseClass(TestCase): return True @classmethod - def setup_volume(cls, volume_create_force=False): + def setup_volume(cls, volume_create_force=False, only_volume_create=False): """Setup the volume: - Create the volume, Start volume, Set volume options, enable snapshot/quota/tier if specified in the config @@ -324,6 +324,9 @@ class GlusterBaseClass(TestCase): Args: volume_create_force(bool): True if create_volume should be executed with 'force' option. + only_volume_create(bool): True, only volume creation is needed + False, by default volume creation and + start. Returns (bool): True if all the steps mentioned in the descriptions passes. False otherwise. @@ -346,12 +349,19 @@ class GlusterBaseClass(TestCase): g.log.info("Setting up volume %s", cls.volname) ret = setup_volume(mnode=cls.mnode, all_servers_info=cls.all_servers_info, - volume_config=cls.volume, force=force_volume_create) + volume_config=cls.volume, force=force_volume_create, + create_only=only_volume_create) if not ret: g.log.error("Failed to Setup volume %s", cls.volname) return False g.log.info("Successful in setting up volume %s", cls.volname) + # Returning the value without proceeding for next steps + if only_volume_create and ret: + g.log.info("Setup volume with volume creation {} " + "successful".format(cls.volname)) + return True + # Wait for volume processes to be online g.log.info("Wait for volume %s processes to be online", cls.volname) ret = wait_for_volume_process_to_be_online(cls.mnode, cls.volname) |