summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-07-13 22:46:34 +0000
committerGerrit Code Review <review@openstack.org>2016-07-13 22:46:34 +0000
commit2c1cfc3a073ec3099434ac79fc083ef6371aa392 (patch)
tree00d537f21e8b551f7be01165e5f251aad8d40f5b
parent10a73b961cc5bb89d8d2c53a2ba90bf336084443 (diff)
parentbb01fe9314f990accfbb1ea11c2a63b4fab1c27f (diff)
Merge "[Tempest] Handle errored shares correctly using recreation logic"3.0.0.0b2
-rw-r--r--manila_tempest_tests/tests/api/base.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index dd90d8f..a599196 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -454,18 +454,28 @@ class BaseSharesTest(test.BaseTestCase):
454 for d in data: 454 for d in data:
455 if d["available"]: 455 if d["available"]:
456 continue 456 continue
457 client = d["kwargs"]["client"]
458 share_id = d["share"]["id"]
457 try: 459 try:
458 d["kwargs"]["client"].wait_for_share_status( 460 client.wait_for_share_status(share_id, "available")
459 d["share"]["id"], "available")
460 d["available"] = True 461 d["available"] = True
461 except (share_exceptions.ShareBuildErrorException, 462 except (share_exceptions.ShareBuildErrorException,
462 exceptions.TimeoutException) as e: 463 exceptions.TimeoutException) as e:
463 if CONF.share.share_creation_retry_number > d["cnt"]: 464 if CONF.share.share_creation_retry_number > d["cnt"]:
464 d["cnt"] += 1 465 d["cnt"] += 1
465 msg = ("Share '%s' failed to be built. " 466 msg = ("Share '%s' failed to be built. "
466 "Trying create another." % d["share"]["id"]) 467 "Trying create another." % share_id)
467 LOG.error(msg) 468 LOG.error(msg)
468 LOG.error(e) 469 LOG.error(e)
470 cg_id = d["kwargs"].get("consistency_group_id")
471 if cg_id:
472 # NOTE(vponomaryov): delete errored share
473 # immediately in case share is part of CG.
474 client.delete_share(
475 share_id,
476 params={"consistency_group_id": cg_id})
477 client.wait_for_resource_deletion(
478 share_id=share_id)
469 d["share"] = cls._create_share( 479 d["share"] = cls._create_share(
470 *d["args"], **d["kwargs"]) 480 *d["args"], **d["kwargs"])
471 else: 481 else: