summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDelia Popescu <delia.popescu@enea.com>2018-07-04 18:05:40 +0300
committerDelia Popescu <delia.popescu@enea.com>2018-07-05 14:08:14 +0000
commit78ca3a8df217cd4a09ad7061496c1028c95576df (patch)
treec13efc9a7d4859dc041004e322e338d027069047
parent0bed33a29da92685dc208b5929de6aefe0c5e5e9 (diff)
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 <delia.popescu@enea.com>
-rw-r--r--functest/opnfv_tests/openstack/cinder/cinder_test.py13
1 files 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):