|
47 | 47 | from utility.constant import ANNOT_CHECKSUM |
48 | 48 | from utility.constant import ANNOT_EXPANDED_SIZE |
49 | 49 | from utility.constant import LABEL_LONGHORN_COMPONENT |
| 50 | +from utility.constant import BLOCK_PVC_VOLUME_DEVICE_PATH |
50 | 51 | import utility.constant as constant |
51 | 52 | from utility.utility import convert_size_to_bytes |
52 | 53 | from utility.utility import logging |
@@ -485,3 +486,20 @@ def verify_fio_data_integrity_in_workload(self, workload_name, namespace="defaul |
485 | 486 | raise AssertionError(f"FIO verification failed with errors: {resp}") |
486 | 487 |
|
487 | 488 | logging(f"FIO data integrity verification passed") |
| 489 | + |
| 490 | + def wait_for_block_device_size_in_pod(self, pod_name, expected_size, namespace="default"): |
| 491 | + for i in range(self.retry_count): |
| 492 | + logging(f"Waiting for block device size in pod {pod_name} to be {expected_size} ... ({i})") |
| 493 | + time.sleep(self.retry_interval) |
| 494 | + cmd = f"blockdev --getsize64 {BLOCK_PVC_VOLUME_DEVICE_PATH}" |
| 495 | + try: |
| 496 | + result = pod_exec(pod_name, namespace, cmd) |
| 497 | + actual_size = result.strip() |
| 498 | + logging(f"Current block device size in pod {pod_name}: {actual_size}, expected: {expected_size}") |
| 499 | + if actual_size == expected_size: |
| 500 | + return |
| 501 | + except Exception as e: |
| 502 | + logging(f"Error checking block device size in pod {pod_name}: {e}") |
| 503 | + continue |
| 504 | + |
| 505 | + assert False, f"Block device size in pod {pod_name} is not {expected_size}" |
0 commit comments