Просмотр исходного кода

Fixed hanging in OpenStack migration providers when the Cinder volume waited after to become 'in-use' becomes 'available'.

Nashwan Azhari 9 лет назад
Родитель
Сommit
674cf8c60c
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      coriolis/providers/openstack/common.py

+ 8 - 1
coriolis/providers/openstack/common.py

@@ -197,7 +197,14 @@ def wait_for_volume(cinder, volume_id, expected_status='available'):
         raise exception.VolumeNotFound(volume_id=volume_id)
     volume = utils.index_singleton_list(volumes)
 
-    while volume.status not in [expected_status, 'error']:
+    terminal_statuses = [expected_status, 'error']
+    if expected_status == 'in-use':
+        # if we're waiting for a volume to become attached, we are guaranteed
+        # that its status would no longer be 'available' the moment the
+        # attachment request is accepted.
+        terminal_statuses.append('available')
+
+    while volume.status not in terminal_statuses:
         LOG.debug('Volume %(id)s status: %(status)s. '
                   'Waiting for status: "%(expected_status)s".',
                   {'id': volume_id, 'status': volume.status,