summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
Commit message (Collapse)AuthorAgeFilesLines
* [Libfix] Fixing the pkill commandBala Konda Reddy M2020-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Below command to 'pkill pidof glusterd' is not right, as it is not getting the pidof glusterd. eg: cmd = "pkill pidof glusterd" ret, out ,err = g.run("10.20.30.40", cmd, "root") >>> ret, out, err (2, '', "pkill: only one pattern can be provided\n Try `pkill --help' for more information.\n") Here command is failing. Solution: Added `pidof glusterd` which will get proper glusterd pid and kill the stale pid after glusterd stop failed. cmd = "pkill `pidof glusterd`" ret, out ,err = g.run("10.20.30.40", cmd, "root") >>> ret, out, err (1, '', '') Note: The ret value is 1, as it is tried on a machine where glusterd is running. The purpose of the fix is to get the proper pid. Change-Id: Iacba3712852b9d16546ced9a4c071c62182fe385 Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
* [Libfix] Kill stale bricks in scratch_cleanupBala Konda Reddy M2020-05-151-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: While performing scratch clenaup, observerd posix health checkers warnings once the glusterd is started as shown below [2020-05-05 12:19:10.633623] M [MSGID: 113075] [posix-helpers.c:2194:posix_health_check_thread_proc] 0-testvol_distributed-dispersed-posix: health-check failed, going down Solution: In scartch cleanup, once the glusterd is stopped, and runtime socket file removed for glusterd daemon, there are stale glusterfsd present on few the machines. Adding a step to get glusterfsd processes if any and using kill_process method killing the stale glusterfsd processes and continuing with the existing procedure. Once the glusterd is started won't see any posix health checkers. Change-Id: Ib3e9492ec029b5c9efd1c07b4badc779375a66d6 Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
* [Libfix] Add function in baseclass for cleanupSri Vignesh2020-03-241-1/+109
| | | | | | | | | | Add docleanup and docleanupclass in baseclass, which will call the function fresh_setup_cleanup, will cleanup the nodes to fresh setup if it is set to true or whenever the testcase fails. Change-Id: I951ff59cc3959ede5580348b7f93b57683880a23 Signed-off-by: Sri Vignesh <sselvan@redhat.com>
* [libfix] Fix framework break due to geo_rep patchkshithijiyer2020-03-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Due to patch [1], the framework broke and was failing for all the testcases with the below backtrace: ``` > mount_dict['server'] = cls.snode E AttributeError: type object 'VolumeAccessibilityTests_cplex_replicated_glusterf' has no attribute 'snode' ``` Solution: This was becasue mnode_slave was accidentally written as snode. And cls.geo_rep_info wasn't a safe condition operator hence changed it to cls.slaves. Testcase results with patch: test_cvt.py::TestGlusterHealSanity_cplex_replicated_glusterfs::test_self_heal_when_io_in_progress PASSED test_cvt.py::TestGlusterExpandVolumeSanity_cplex_distributed-dispersed_glusterfs::test_expanding_volume_when_io_in_progress PASSED test_cvt.py::TestGlusterHealSanity_cplex_dispersed_glusterfs::test_self_heal_when_io_in_progress PASSED test_cvt.py::TestGlusterExpandVolumeSanity_cplex_distributed_nfs::test_expanding_volume_when_io_in_progress PASSED test_cvt.py::TestQuotaSanity_cplex_replicated_nfs::test_quota_enable_disable_enable_when_io_in_progress PASSED test_cvt.py::TestSnapshotSanity_cplex_distributed-dispersed_glusterfs::test_snapshot_basic_commands_when_io_in_progress PASSED test_cvt.py::TestGlusterReplaceBrickSanity_cplex_distributed-replicated_glusterfs::test_replace_brick_when_io_in_progress PASSED test_cvt.py::TestQuotaSanity_cplex_distributed_nfs::test_quota_enable_disable_enable_when_io_in_progress PASSED test_cvt.py::TestGlusterExpandVolumeSanity_cplex_dispersed_glusterfs::test_expanding_volume_when_io_in_progress PASSED test_cvt.py::TestGlusterShrinkVolumeSanity_cplex_distributed-dispersed_glusterfs::test_shrinking_volume_when_io_in_progress PASSED test_cvt.py::TestGlusterExpandVolumeSanity_cplex_dispersed_nfs::test_expanding_volume_when_io_in_progress PASSED test_cvt.py::TestGlusterShrinkVolumeSanity_cplex_distributed_glusterfs::test_shrinking_volume_when_io_in_progress PASSED test_cvt.py::TestGlusterExpandVolumeSanity_cplex_distributed_glusterfs::test_expanding_volume_when_io_in_progress PASSED test_cvt.py::TestQuotaSanity_cplex_dispersed_nfs::test_quota_enable_disable_enable_when_io_in_progress PASSED test_cvt.py::TestSnapshotSanity_cplex_distributed-replicated_glusterfs::test_snapshot_basic_commands_when_io_in_progress PASSED test_cvt.py::TestSnapshotSanity_cplex_dispersed_glusterfs::test_snapshot_basic_commands_when_io_in_progress PASSED test_cvt.py::TestQuotaSanity_cplex_distributed-replicated_glusterfs::test_quota_enable_disable_enable_when_io_in_progress PASSED test_cvt.py::TestSnapshotSanity_cplex_replicated_glusterfs::test_snapshot_basic_commands_when_io_in_progress PASSED test_cvt.py::TestGlusterShrinkVolumeSanity_cplex_distributed-dispersed_nfs::test_shrinking_volume_when_io_in_progress PASSED test_cvt.py::TestGlusterShrinkVolumeSanity_cplex_distributed_nfs::test_shrinking_volume_when_io_in_progress PASSED links: [1] https://review.gluster.org/#/c/glusto-tests/+/24029/ Change-Id: If7b329e232ab61df9f9d38f5491c58693336dd48 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* [lib] Add functionality to setup master and slave volumeskshithijiyer2020-03-021-0/+60
| | | | | | | | | | | | | Adding the code for the following: 1.Adding function setup_master_and_slave_volumes() to geo_rep_libs. 2.Adding variables for master_mounts, slave_mounts, master_volume and slave_volume to gluster_base_class.py 3.Adding class class method setup_and_mount_geo_rep_master_and_slave_volumes to gluster_base_class.py. Change-Id: Ic8ae1cb1c8b5719d4774996c3e9e978551414b44 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* [Libfix] Add steps to bring bricks online and volume resetSri Vignesh2020-02-171-1/+28
| | | | | | | | Add steps to include bring offline bricks to online and volume reset in case of failure scenarios Change-Id: I9bdadd8a80ded81cf7cb4e324a18321400bfcc4c Signed-off-by: Sri Vignesh <sselvan@redhat.com>
* [LibFix][TestFix] Add function get_unique_lv_list_from_all_serversSri Vignesh2020-01-281-3/+48
| | | | | | | | Added library to cleanup lv created after snapshot clone and made modifications with cleanup. Change-Id: I71a437bf99eac1170895510475ddb30748771672 Signed-off-by: Sri Vignesh <sselvan@redhat.com>
* [Fix] Fixing keyerror introduced in the gluster_base_classkshithijiyer2020-01-171-0/+2
| | | | | | | | Fixing keyerror introduced in the patch: https://review.gluster.org/#/c/glusto-tests/+/23967/ Change-Id: Ib44678fe46df5090b1586b09b47d3046c4dc6f9b Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* [lib] Adding geo-rep params in gluster_base_class.pykshithijiyer2020-01-161-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adding params in gluster_base_class.py to store value of root user's password and non-root user's name, group and password. sync_method will be mentioned inside the testcase as there are testcases which are only specific to one of the sync type and it doesn't make sense to add it in the config file. Instead we'll write testcase as shown below: ``` class georeptestcase(baseclass): run_chmod_with_changelog_crawl(sync_type): # Steps of the testcase test_chmod_with_changelog_crawl_rsync(): # Calling function with rsync as sync_type. run_chmod_with_changelog_crawl('rsync') test_chmod_with_changelog_crawl_tarssh(): # Calling function with tarssh as sync_type. run_chmod_with_changelog_crawl('tarssh') ``` Change-Id: Ie65f542e76bfbee89ac2914bdcd086e1bd08dfdb Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* [py2to3] Change str to list in isinstance()kshithijiyer2020-01-091-1/+1
| | | | | | | | | | | | Use 'list' object type in comparisons instead of 'str' Because it is differently treated in py2 and py3. Example: In py2 isinstance(u'foo', str) is False In py3 isinstance(u'foo', str) is True Change-Id: I7663d42494bf59d74550ff4897379d35cc357db4 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* Fix volume cleanup in 'gluster_base_class' moduleValerii Ponomarov2019-12-171-1/+1
| | | | | | | | | | | | | One of the recent changes [1] broke volume cleanup logic which is located in base class. Fix it by proper handling of the cleanup function results where '0' return code is 'success' and not 'failure' as it was considered in that change. [1] 6cd137615aec29dade5b41975fcbdae06852cf53 Change-Id: I674493369202ceabc6983fae0b3834e3b0708bf1 Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
* Add steps to stablize the existing contents in cleanupSri Vignesh2019-12-131-7/+18
| | | | | Change-Id: I0d405afb3ed84ae8a67f7c2e6a303063096f490c Signed-off-by: Sri Vignesh <sselvan@redhat.com>
* [py2to3] Add py3 support for tests in 'tests/functional/bvt'Valerii Ponomarov2019-12-091-6/+4
| | | | | Change-Id: I8b8aad4c3e4a2ad924478f1842498289323b7098 Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
* [lib]:Adding the default configs for arbiter and dist-arbitersayaleeraut2019-11-291-1/+15
| | | | | | | | | | | Adding the default configurations for arbiter and distributed- arbiter volume types, as it was missing from the gluster_base_class.py. Adding Arbiter and Distributed arbiter configuration in the glusto_tests_config.yml Change-Id: Ic078505975ff1a1171a4bc6ee6ad2c67f0fb45f1 Signed-off-by: sayaleeraut <saraut@redhat.com>
* [py2to3] Refactor gluster_base_class.pyValerii Ponomarov2019-11-281-165/+127
| | | | | | | | | | | | | | | | | | Following changes were implemented: - Delete unused imports and place used ones in the alphabetical order. Imports are splitted into 3 groups: built-ins, third-parties and local modules/libs. - Make changes to support py3 in addition to py2. - Minimize number of code lines keeping the same behaviour and improving readability. - Add possibility to get 'bound' (cls) methods using 'get_super_method' staticmethod from base class. Before it was possible to call only unbound (self) methods. - Update 'test_add_brick.py' module as PoC for running base class bound methods in both - py2 and py3. Now this module py2/3 compatible. Change-Id: I1b66b3a91084b2487c26bec8763ab2b4e12ac482 Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
* [py2to3] Delete 'GlusterBlockBaseClass'Valerii Ponomarov2019-11-281-646/+1
| | | | | | | | | For following reasons: - It is unused. - It is not compatible with py3. Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com> Change-Id: Ied6373c398406ffd08d7673892fde89ec6e04fe2
* [py2to3] Add method to the base class for proper calling of it's methodsValerii Ponomarov2019-11-221-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lots of test classes are wrapped by the 'runs_on' decorator. This decorator replaces original test class with it's copy where parent class is original test class if we use py3. Such situation leads to the impossibility to use following approach in py3: super(SomeClass, some_class_instance).some_method() And, the above approach is py2/3 compatible approach for calling parent class's methods. The problem we face is that we fall into the unexpected recursion here. So, add 'get_super_method' to the base class, which detects such situation and returns proper method of a proper parent class. Also, fix test class located at 'glusterd/test_peer_status.py' module to have proof of concept. With this change 'test_peer_probe_status' test case becomes completely py2/3 compatible. Example of new method usage: @runs_on([['distributed'], ['glusterfs']]) class TestDecoratedClass(GlusterBaseClass): ... def setUp(self): self.get_super_method(self, 'setUp')() ... This approach must be used instead of existing calls of 'im_func' function if we want to support both at once - python2 and python3. Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com> Change-Id: I23f4462b64f9d4dd90812273f08fb756d073ab76
* [py2to3] Replace usage of ".iteitems()" attr with ".items()"Valerii Ponomarov2019-11-211-1/+1
| | | | | | | | Dict attribute called "iteritems()" is not supported in the py3. So, replace it's usage with another similar attr called "items()". Change-Id: I130b7f67f0a2d5da5ed6c3d792f5ff024ba148f4 Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
* Modificatons to base class to include slave infoRoch-elle2019-04-121-0/+14
| | | | | | | Added new config file for georep Change-Id: I544ee35f8cd6a2f2ed744f72caa28fa4fd63e5b3 Signed-off-by: Roch-elle <rallan@redhat.com>
* Delete quorum method from old file. Added fixes for flake8Vitalii Koriakov2019-01-301-74/+74
| | | | | Change-Id: I2acf835a4cf7301c64c4c8a9423f78672cdf9aa4 Signed-off-by: Vitalii Koriakov <vkoriako@redhat.com>
* glustolibs: Add GlusterBlockBaseClassbhumikagoyal2018-10-251-2/+647
| | | | | | | | | | | | | | | | | | | | | | | | | | Add the base class for gluster-block which includes functions that helps in automating the test cases on client and target side. These functions will help in block creation, block discovery, login on the client, getting mpath, mounting the block, logout. The teardown function will take care of unmounting blocks, logging out and block deletion and volume cleanup. The .yml file for block should be like: Example gluster_block_args_info: volname: testvol #Should be same as volume name in glusterfs config fle servers: #Server names should be same as names in glusterfs config file - 192.168.100.163 - 192.168.100.192 size: 2GiB ha: 3 auth: enable prealloc: num_of_blocks: 2 #Number of blocks to be created with this configuration ring-buffer: 16 blockname: block_testing #Base name of the blocks to be created. Change-Id: I8cd354fc991cd21c542cfd7f03399cc23c9f7917 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* Revert "Raise Exceptions in setup_volume and mount_volume"Jonathan Holloway2018-09-141-77/+96
| | | | | | This reverts commit 2d425798657a725e02d63ff631c5b87187ea4ca4. Change-Id: I388fe7ff11e28e027fe9006512e35ec57ff10d9c
* Raise Exceptions in setup_volume and mount_volumeNigel Babu2018-09-121-96/+77
| | | | Change-Id: I1310b9da1262b06e77a621831d599cd4077c31ed
* This makes sure BVT passes when runs_on is emptyNigel Babu2018-02-131-1/+1
| | | | | | Needs to be done for cases where we don't use runs_on Change-Id: I0d5b424621706842fb1a8cccb17c653c6dcff72d
* Inject messages to client gluster logs only if theShwethaHP2018-02-011-5/+7
| | | | | | | mount_type is 'glusterfs' Change-Id: I00f0b5edfea0e09381d1404a0cfd16396a8fbde9 Signed-off-by: ShwethaHP <spandura@redhat.com>
* Use wait_for_volume_process_to_be_onlineShwethaHP2018-01-301-16/+21
| | | | | | | | Replace all the time.sleep() instances with wait_for_volume_process_to_be_online function Change-Id: Id7e34979f811bd85f7475748406803026741a3a8 Signed-off-by: ShwethaHP <spandura@redhat.com>
* Override default volume_type configuration in gluster base class ifShwethaHP2018-01-161-1/+25
| | | | | | | | | volume type configuration is defined in the config file. Providing an option in config file to create volume with 'force' option. Change-Id: Ifeac20685f0949f7573257f30f05df6f79ce1dbd Signed-off-by: ShwethaHP <spandura@redhat.com>
* Modifying gluster_base_class to have static methods for :ShwethaHP2017-12-131-151/+317
| | | | | | | | | | | | | | | | | | | | | | | | 1. setup_volume 2. mount_volume 3. setup_volume_and_mount 4. cleanup_volume 5. unmount_volume 6. unmount_and_cleanup_volume These are added as static methods to give the test developer the flexibility to call the setup/cleanup's or any other function from any where in the testclass which inherits GlusterBaseClass Also, this will remove the need for GlusterVolumeBaseClass and hence removing the hardcoding of creattion of volume, mouting in setUpClass of GlusterVolumeBaseClass. This will also help in writing new baseclasses for example: Block which can have class funcitons specific to block and inherit all the functions from GlusterBaseClass Change-Id: I3f0709af75e5bb242d265d04ada3a747c155211d Signed-off-by: ShwethaHP <spandura@redhat.com>
* glustolibs: Handled the case to honour mounts option in config.yml if it is ↵Arthy Loganathan2017-09-111-8/+19
| | | | | | | specified Change-Id: Icb47d923860bbd2c1c70d2f7c23965a5368afa52 Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
* Making mounting of volume optional in the BaseClass.ShwethaHP2017-08-311-15/+34
| | | | | | | | Mounting of a volume will not always be distributed volume. Providing a option to mount a local volume as well. Change-Id: Iadbb596fba7e2a5fa4ba3ba53967961a70d00c8c Signed-off-by: ShwethaHP <spandura@redhat.com>
* Providing configs to set volume options, group options when exporting volume ↵ShwethaHP2017-08-091-1/+44
| | | | | | | | | | | | | | | as 'smb share', 'nfs-ganesha export' in the config yml. Reading the configs in the gluster_base_class and setting those configs when exporting the volumes as 'smb share' or 'nfs-ganesha export'. recommended options when exporting volume as 'smb share': group: "metadata-cache" cache-samba-metadata: "on" Change-Id: I86a118c7015eaedd849a0f6e8b613605df5b6c32 Signed-off-by: ShwethaHP <spandura@redhat.com>
* add gluster object exists check to volume config defaultJonathan Holloway2017-08-081-4/+3
| | | | | | | | | gluster_base_class.py: fix error by adding check to ensure gluster entry exists when no gluster object defined in config file setup.py: version up to 0.21 Change-Id: I37001673c03a32571b78bbd32489fc1992333d73 Signed-off-by: Jonathan Holloway <jholloway@redhat.com>
* Set volume options on all the volume typesShwethaHP2017-08-031-1/+8
| | | | | | | | | | | | Providing a section in the config file to set volume options that can be applicable to any volume type created. The glusterbase class also reads the volume_options if provided in config file and set it on all the volumes being created. These volume options will be overwritten if there are any volume options specified while defining the volumes under 'volumes' section. Change-Id: I0003312251b4f8b151c9ba5c71d1b6a8884cc85e Signed-off-by: ShwethaHP <spandura@redhat.com>
* Inject gluster,samba,nfs logs with messageShwethaHP2017-07-261-7/+85
| | | | | Change-Id: If16daf6a0633c4ea30f7fb91b919d2ec42d0ff62 Signed-off-by: ShwethaHP <spandura@redhat.com>
* running_on_volumes, running_on_mounts should be an optionShwethaHP2017-06-271-5/+10
| | | | | | | | | | under gluster in the config file. Currently the config file has the options under gluster tag. Hence making the appropriate changes in the runs_on to parse the options correctly. Change-Id: Iec95d1884b13c349a36c4324b571a1c0f23c930a Signed-off-by: ShwethaHP <spandura@redhat.com>
* Minor changes in gluster base class wrt nfs-ganeshaArthy Loganathan2017-06-121-1/+8
| | | | | Change-Id: Iaceb22cd5b2fe920c9cdc6d110d26939e26e5ffe Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
* Adding a new test to VVT:Shwetha Panduranga2017-02-271-195/+205
| | | | | | | | | | | | | | | | | | | | | 1) glusterbaseclass: - Making changes in glusterbaseclass to not necessarily have volume_type and mount_type. 2) volume_libs: - setup_volume don't have to export the volume. It just creates starts and setup's any operation on the volume. - Moved the sharing/exporting the volume to BaseClass 3) Renaming samba_ops to samba_libs to have better naming practice. 4) Adding nfs_ganesha_libs for any nfs related helper functions 5) Adding a new vvt case which creates, deteles, creates the volume. Change-Id: I238c349df7165d669d3bc7234d97845dba2f51a6 Signed-off-by: Shwetha Panduranga <spandura@redhat.com>
* Raise custom exceptions rather assert failuresNigel Babu2017-02-011-15/+27
| | | | | | | | | The setup should never raise an assert failure in a test. Only tests should fail an assert. If an essential test setup doesn't work, we should be raising custom exceptions instead. Change-Id: I6d5cce448132b71b6fde3a39fef894be8b1216d3 Signed-off-by: Nigel Babu <nigelb@redhat.com>
* Clean up pyflakes and pep8 errorsNigel Babu2016-12-121-5/+5
| | | | | Change-Id: Ibdd092118d3bb912716c46fd278ef3c680a6e742 Signed-off-by: Nigel Babu <nigelb@redhat.com>
* Modifying the glusterbaseclass not to update the defaul values to global config.Shwetha Panduranga2016-12-051-52/+76
| | | | | | | | | For example: if 'volname' is not in mount, then do not update the default volname in g.config['mount']. Change-Id: Ib547b51372b16a08b07c11a5dcf70feca8674075 Signed-off-by: Shwetha Panduranga <spandura@redhat.com>
* Start gluster nfs-server only when the mount type is 'nfs'.Shwetha Panduranga2016-12-011-2/+10
| | | | | Change-Id: Ie7a25927d9bd55a7115adfae4fd550f96f435950 Signed-off-by: Shwetha Panduranga <spandura@redhat.com>
* Improving the GlusterVolumeBaseClass to check for nfs and smb exports.Shwetha Panduranga2016-11-301-27/+48
| | | | | | | | | | Removing starting glusterd, peer probe from VolumeBaseClass and assuming the config/setup phase to handle the glusterd, peer probe. Changing the BVT case to baseclass 'GlusterVolumeBaseClass'. Change-Id: I930d785dfe652b826e4a1853f30a954f98d15ede Signed-off-by: Shwetha Panduranga <spandura@redhat.com>
* Adding a bvt testcaseShwetha Panduranga2016-10-261-22/+62
| | | | | Change-Id: Ide7e3bac46fbaf354a2a5c8baef8510b4aefec78 Signed-off-by: Shwetha Panduranga <spandura@redhat.com>
* Changed GlusterDemoClass to GlusterVolumeBaseClassArthy Loganathan2016-10-251-1/+1
| | | | | Change-Id: I7cb15b6fb6f3d6a2a24c9c1a6677b9d5948142ea Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
* Adding libs for brick ops, volume helpers, mount helpers, gluster baseShwetha Panduranga2016-10-171-0/+274
class, heal related helpers, samba helpers, and windows ops helpers Change-Id: I0ad8fc7548c88e89d2ba6441166b9a38af76cea0 Signed-off-by: Shwetha Panduranga <spandura@redhat.com>