ceph/rbd_mirror: Optionally require presence of images in wait-helper
When you tell Ceph to resync mirrored RBD images it will in practice remove and re-create the image. At present the image state wait helper will happilly accept no images in a pool as a positive outcome. Add optional ``require_images_in`` parameter that allows the wait helper to block even when no images are available in the pool (yet)
This commit is contained in:
@@ -68,7 +68,8 @@ class CephRBDMirrorBase(test_utils.OpenStackBaseTest):
|
||||
|
||||
def wait_for_mirror_state(self, state, application_name=None,
|
||||
model_name=None,
|
||||
check_entries_behind_master=False):
|
||||
check_entries_behind_master=False,
|
||||
require_images_in=[]):
|
||||
"""Wait until all images reach requested state.
|
||||
|
||||
This function runs the ``status`` action and examines the data it
|
||||
@@ -85,6 +86,8 @@ class CephRBDMirrorBase(test_utils.OpenStackBaseTest):
|
||||
when used with state
|
||||
``up+replying``.
|
||||
:type check_entries_behind_master: bool
|
||||
:param require_images_in: List of pools to require images in
|
||||
:type require_images_in: list of str
|
||||
:returns: True on success, never returns on failure
|
||||
"""
|
||||
rep = re.compile(r'.*entries_behind_master=(\d+)')
|
||||
@@ -92,7 +95,10 @@ class CephRBDMirrorBase(test_utils.OpenStackBaseTest):
|
||||
pool_status = self.run_status_action(
|
||||
application_name=application_name, model_name=model_name)
|
||||
for pool, status in pool_status.items():
|
||||
for image in status.get('images', []):
|
||||
images = status.get('images', [])
|
||||
if not len(images) and pool in require_images_in:
|
||||
break
|
||||
for image in images:
|
||||
if image['state'] and image['state'] != state:
|
||||
break
|
||||
if check_entries_behind_master:
|
||||
@@ -304,7 +310,8 @@ class CephRBDMirrorControlledFailoverTest(CephRBDMirrorBase):
|
||||
self.wait_for_mirror_state(
|
||||
'up+replaying',
|
||||
application_name=self.application_name + self.site_b_app_suffix,
|
||||
model_name=self.site_b_model)
|
||||
model_name=self.site_b_model,
|
||||
require_images_in['cinder-ceph', 'glance'])
|
||||
|
||||
|
||||
class CephRBDMirrorDisasterFailoverTest(CephRBDMirrorBase):
|
||||
|
||||
Reference in New Issue
Block a user