diff options
author | spisarski <s.pisarski@cablelabs.com> | 2018-02-05 11:52:55 -0700 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2018-02-06 14:21:58 -0700 |
commit | 9bff6e98c84344bf82d84ebf9f9db0c5def4a685 (patch) | |
tree | 0dd1d37374e5b5fc6e1458187b1619cc889f6cd5 /snaps/openstack/create_instance.py | |
parent | 9cf59ae0a133b0c8ab3907c84ec3c7b962df599a (diff) |
Fixed timeout logic when attaching/detaching volumes.
The timeout logic in nova_utils.attach_volume() and detach_volume()
was not correct which may have been the root cause behind the issue
FUNCTEST-927. Timeout in both attach and detach is no longer
optional.
Also added a test to attach and detach without timeout as that path
was never tested. Updated associated test documentation as well.
JIRA: SNAPS-263
JIRA: FUNCTEST-927
Change-Id: Iea3aeab59c378917fbd175d673113e8d30e2e4b9
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/create_instance.py')
-rw-r--r-- | snaps/openstack/create_instance.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/snaps/openstack/create_instance.py b/snaps/openstack/create_instance.py index cdc778f..73cdf8a 100644 --- a/snaps/openstack/create_instance.py +++ b/snaps/openstack/create_instance.py @@ -30,6 +30,7 @@ __author__ = 'spisarski' logger = logging.getLogger('create_instance') POLL_INTERVAL = 3 +VOL_DETACH_TIMEOUT = 120 STATUS_ACTIVE = 'ACTIVE' STATUS_DELETED = 'DELETED' @@ -164,15 +165,15 @@ class OpenStackVmInstance(OpenStackComputeObject): cinder, volume_name=volume_name) if volume and self.vm_active(block=True): - timeout = 30 vm = nova_utils.attach_volume( - self._nova, self.__neutron, self.__vm, volume, timeout) + self._nova, self.__neutron, self.__vm, volume, + VOL_DETACH_TIMEOUT) if vm: self.__vm = vm else: logger.warn('Volume [%s] not attached within timeout ' - 'of [%s]', volume.name, timeout) + 'of [%s]', volume.name, VOL_DETACH_TIMEOUT) else: logger.warn('Unable to attach volume named [%s]', volume_name) @@ -271,7 +272,8 @@ class OpenStackVmInstance(OpenStackComputeObject): cinder, volume_rec['id']) if volume: vm = nova_utils.detach_volume( - self._nova, self.__neutron, self.__vm, volume, 30) + self._nova, self.__neutron, self.__vm, volume, + VOL_DETACH_TIMEOUT) if vm: self.__vm = vm else: |