[Tempest] Handle errored shares correctly using recreation logic
If we allow share recreation and get some share errored making it part of CG, then we fail to create CG snapshot from CG that owns this share. Because cleanup step was not reached yet. Therefore, consider this case and delete errored shares immediately. Change-Id: Ib05598de8fbd1c9a735ca91159f3f5cfb86d8889 Closes-Bug: #1577887
This commit is contained in:
parent
ee0e68e156
commit
bb01fe9314
|
@ -454,18 +454,28 @@ class BaseSharesTest(test.BaseTestCase):
|
|||
for d in data:
|
||||
if d["available"]:
|
||||
continue
|
||||
client = d["kwargs"]["client"]
|
||||
share_id = d["share"]["id"]
|
||||
try:
|
||||
d["kwargs"]["client"].wait_for_share_status(
|
||||
d["share"]["id"], "available")
|
||||
client.wait_for_share_status(share_id, "available")
|
||||
d["available"] = True
|
||||
except (share_exceptions.ShareBuildErrorException,
|
||||
exceptions.TimeoutException) as e:
|
||||
if CONF.share.share_creation_retry_number > d["cnt"]:
|
||||
d["cnt"] += 1
|
||||
msg = ("Share '%s' failed to be built. "
|
||||
"Trying create another." % d["share"]["id"])
|
||||
"Trying create another." % share_id)
|
||||
LOG.error(msg)
|
||||
LOG.error(e)
|
||||
cg_id = d["kwargs"].get("consistency_group_id")
|
||||
if cg_id:
|
||||
# NOTE(vponomaryov): delete errored share
|
||||
# immediately in case share is part of CG.
|
||||
client.delete_share(
|
||||
share_id,
|
||||
params={"consistency_group_id": cg_id})
|
||||
client.wait_for_resource_deletion(
|
||||
share_id=share_id)
|
||||
d["share"] = cls._create_share(
|
||||
*d["args"], **d["kwargs"])
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue