Browse Source

Merge "[Tempest] Handle errored shares correctly using recreation logic"

Jenkins 2 years ago
parent
commit
2c1cfc3a07
1 changed files with 13 additions and 3 deletions
  1. 13
    3
      manila_tempest_tests/tests/api/base.py

+ 13
- 3
manila_tempest_tests/tests/api/base.py View File

@@ -454,18 +454,28 @@ class BaseSharesTest(test.BaseTestCase):
454 454
             for d in data:
455 455
                 if d["available"]:
456 456
                     continue
457
+                client = d["kwargs"]["client"]
458
+                share_id = d["share"]["id"]
457 459
                 try:
458
-                    d["kwargs"]["client"].wait_for_share_status(
459
-                        d["share"]["id"], "available")
460
+                    client.wait_for_share_status(share_id, "available")
460 461
                     d["available"] = True
461 462
                 except (share_exceptions.ShareBuildErrorException,
462 463
                         exceptions.TimeoutException) as e:
463 464
                     if CONF.share.share_creation_retry_number > d["cnt"]:
464 465
                         d["cnt"] += 1
465 466
                         msg = ("Share '%s' failed to be built. "
466
-                               "Trying create another." % d["share"]["id"])
467
+                               "Trying create another." % share_id)
467 468
                         LOG.error(msg)
468 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 479
                         d["share"] = cls._create_share(
470 480
                             *d["args"], **d["kwargs"])
471 481
                     else:

Loading…
Cancel
Save