| 428 | |
| 429 | |
| 430 | def remove_cluster(): |
| 431 | if USE_CASS_EXTERNAL or KEEP_TEST_CLUSTER: |
| 432 | return |
| 433 | |
| 434 | global CCM_CLUSTER |
| 435 | if CCM_CLUSTER: |
| 436 | check_log_error() |
| 437 | log.debug("Removing cluster {0}".format(CCM_CLUSTER.name)) |
| 438 | tries = 0 |
| 439 | while tries < 100: |
| 440 | try: |
| 441 | CCM_CLUSTER.remove() |
| 442 | CCM_CLUSTER = None |
| 443 | return |
| 444 | except OSError: |
| 445 | ex_type, ex, tb = sys.exc_info() |
| 446 | log.warning("{0}: {1} Backtrace: {2}".format(ex_type.__name__, ex, traceback.extract_tb(tb))) |
| 447 | del tb |
| 448 | tries += 1 |
| 449 | time.sleep(1) |
| 450 | |
| 451 | raise RuntimeError("Failed to remove cluster after 100 attempts") |
| 452 | |
| 453 | |
| 454 | def is_current_cluster(cluster_name, node_counts, workloads): |