2022-07-27 10:42:29 +00:00
|
|
|
import time
|
2022-07-05 07:18:37 +00:00
|
|
|
|
2023-11-29 13:34:59 +00:00
|
|
|
from frostfs_testlib import reporter
|
2023-05-15 09:59:33 +00:00
|
|
|
from frostfs_testlib.resources.common import STORAGE_GC_TIME
|
2023-02-19 23:58:07 +00:00
|
|
|
from frostfs_testlib.utils import datetime_utils
|
2022-07-08 17:24:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def placement_policy_from_container(container_info: str) -> str:
|
|
|
|
"""
|
2023-02-27 17:28:56 +00:00
|
|
|
Get placement policy from container info:
|
2022-07-08 17:24:55 +00:00
|
|
|
|
|
|
|
container ID: j7k4auNHRmiPMSmnH2qENLECD2au2y675fvTX6csDwd
|
|
|
|
version: 2.12
|
|
|
|
owner ID: NQ8HUxE5qEj7UUvADj7z9Z7pcvJdjtPwuw
|
2022-08-12 07:23:23 +00:00
|
|
|
basic ACL: 0fbfbfff (eacl-public-read-write)
|
2022-07-08 17:24:55 +00:00
|
|
|
attribute: Timestamp=1656340345 (2022-06-27 17:32:25 +0300 MSK)
|
|
|
|
nonce: 1c511e88-efd7-4004-8dbf-14391a5d375a
|
|
|
|
placement policy:
|
|
|
|
REP 1 IN LOC_PLACE
|
|
|
|
CBF 1
|
|
|
|
SELECT 1 FROM LOC_SW AS LOC_PLACE
|
|
|
|
FILTER Country EQ Sweden AS LOC_SW
|
|
|
|
|
|
|
|
Args:
|
2023-01-09 12:46:03 +00:00
|
|
|
container_info: output from frostfs-cli container get command
|
2022-07-08 17:24:55 +00:00
|
|
|
|
|
|
|
Returns:
|
|
|
|
placement policy as a string
|
|
|
|
"""
|
2022-09-23 11:09:41 +00:00
|
|
|
assert ":" in container_info, f"Could not find placement rule in the output {container_info}"
|
|
|
|
return container_info.split(":")[-1].replace("\n", " ").strip()
|
2022-07-27 10:42:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
def wait_for_gc_pass_on_storage_nodes() -> None:
|
2023-02-19 23:58:07 +00:00
|
|
|
wait_time = datetime_utils.parse_time(STORAGE_GC_TIME)
|
2023-11-29 13:34:59 +00:00
|
|
|
with reporter.step(f"Wait {wait_time}s until GC completes on storage nodes"):
|
2022-07-27 10:42:29 +00:00
|
|
|
time.sleep(wait_time)
|