From 78ca3a8df217cd4a09ad7061496c1028c95576df Mon Sep 17 00:00:00 2001 From: Delia Popescu Date: Wed, 4 Jul 2018 18:05:40 +0300 Subject: Set timeout for create, attach and detach volume Without timeout for volume opperations the testcase will fail only after functest timeout Change-Id: I669c7933846574c09fc7db06a2a2ce7d101a44f5 Signed-off-by: Delia Popescu --- functest/opnfv_tests/openstack/cinder/cinder_test.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/functest/opnfv_tests/openstack/cinder/cinder_test.py b/functest/opnfv_tests/openstack/cinder/cinder_test.py index cc14752ea..7d4b4358b 100644 --- a/functest/opnfv_tests/openstack/cinder/cinder_test.py +++ b/functest/opnfv_tests/openstack/cinder/cinder_test.py @@ -29,6 +29,7 @@ class CinderCheck(singlevm.SingleVm2): to connect to the VMs and one data volume """ # pylint: disable=too-many-instance-attributes + volume_timeout = 60 def __init__(self, **kwargs): """Initialize testcase.""" @@ -58,11 +59,13 @@ class CinderCheck(singlevm.SingleVm2): security_groups=[self.sec.id]) (self.fip2, self.ssh2) = self.connect(self.vm2) self.volume = self.cloud.create_volume( - name='{}-volume_{}'.format(self.case_name, self.guid), size='2') + name='{}-volume_{}'.format(self.case_name, self.guid), size='2', + timeout=self.volume_timeout) def _write_data(self): assert self.cloud - self.cloud.attach_volume(self.sshvm, self.volume) + self.cloud.attach_volume(self.sshvm, self.volume, + timeout=self.volume_timeout) write_data_script = pkg_resources.resource_filename( 'functest.opnfv_tests.openstack.cinder', 'write_data.sh') try: @@ -85,7 +88,8 @@ class CinderCheck(singlevm.SingleVm2): assert self.cloud # Attach volume to VM 2 self.logger.info("Attach volume to VM 2") - self.cloud.attach_volume(self.vm2, self.volume) + self.cloud.attach_volume(self.vm2, self.volume, + timeout=self.volume_timeout) # Check volume data read_data_script = pkg_resources.resource_filename( 'functest.opnfv_tests.openstack.cinder', 'read_data.sh') @@ -101,7 +105,8 @@ class CinderCheck(singlevm.SingleVm2): self.logger.debug("read volume stdout: %s", stdout.read()) self.logger.debug("read volume stderr: %s", stderr.read()) self.logger.info("Detach volume from VM 2") - self.cloud.detach_volume(self.vm2, self.volume) + self.cloud.detach_volume(self.vm2, self.volume, + timeout=self.volume_timeout) return stdout.channel.recv_exit_status() def clean(self): -- cgit 1.2.3-korg