diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2018-12-24 23:45:34 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2018-12-26 12:01:47 +0000 |
commit | 2f10df03bd283c66b2a3c22e40d9ed79f14f1d9e (patch) | |
tree | 25b1291a392c235b312aeb7ce3e34df718d26016 /tests | |
parent | 8b6107b62dacf5edc264f4f0206771d8fa07f7bf (diff) |
Fix CNS-797 and CNS-798 test cases
In some rare cases we get following error trying to create distributed
volume:
- Insufficient suitable allocatable extents for
logical volume tp_foo: 25344 more required.
So, fix such situation by catching exception with such message and
retrying with smaller volume size.
Change-Id: I015a4547347858cd8aff9e566e3dc662a94b6b83
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py b/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py index 561e1342..98a136d6 100644 --- a/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py +++ b/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py @@ -4,6 +4,7 @@ import math from glusto.core import Glusto as g from glustolibs.gluster.volume_ops import get_volume_list, get_volume_info +from cnslibs.common import exceptions from cnslibs.common.heketi_libs import HeketiBaseClass from cnslibs.common.heketi_ops import (heketi_node_list, heketi_node_enable, @@ -94,10 +95,27 @@ class TestHeketiVolume(HeketiBaseClass): # Create distributed vol vol_size_gb = self._get_vol_size() heketi_url = self.heketi_server_url - heketi_vol = heketi_volume_create( - self.heketi_client_node, heketi_url, vol_size_gb, json=True) - self.assertTrue( - heketi_vol, "Failed to create vol of %d size." % vol_size_gb) + try: + g.log.info( + "Trying to create distributed '%s'Gb volume." % vol_size_gb) + heketi_vol = heketi_volume_create( + self.heketi_client_node, heketi_url, vol_size_gb, json=True) + except exceptions.ExecutionError as e: + # NOTE: rare situation when we need to decrease size of a volume. + # and we expect this vol to be distributed. + g.log.info("Failed to create distributed '%s'Gb volume. " + "Trying to create another one, smaller for 1Gb.") + if ('more required' in str(e) + and ('Insufficient suitable allocatable extents for ' + 'logical volume' in str(e))): + vol_size_gb -= 1 + heketi_vol = heketi_volume_create( + self.heketi_client_node, heketi_url, vol_size_gb, + json=True) + else: + raise + g.log.info("Successfully created distributed volume.") + vol_name = heketi_vol['name'] vol_id = heketi_vol["bricks"][0]["volume"] self.addCleanup( |