From 27f14a96b00403b1af4c7bbffbe184ac2d3b69c1 Mon Sep 17 00:00:00 2001 From: hamdykhader Date: Tue, 3 Mar 2026 19:41:46 +0300 Subject: [PATCH 1/3] tmp migration: store devices ids on which the migrations is running Compare the devices for any status change and run migration again --- simplyblock_core/services/tasks_runner_migration.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/simplyblock_core/services/tasks_runner_migration.py b/simplyblock_core/services/tasks_runner_migration.py index c1e67d29c..26bece72b 100644 --- a/simplyblock_core/services/tasks_runner_migration.py +++ b/simplyblock_core/services/tasks_runner_migration.py @@ -46,13 +46,13 @@ def task_runner(task): return False if task.status in [JobSchedule.STATUS_NEW, JobSchedule.STATUS_SUSPENDED]: - current_online_devices = 0 + current_online_devices = [] for node in db.get_storage_nodes_by_cluster_id(task.cluster_id): if node.is_secondary_node: # pass continue for dev in node.nvme_devices: if dev.status == NVMeDevice.STATUS_ONLINE: - current_online_devices += 1 + current_online_devices.append(dev.get_id()) if node.status == StorageNode.STATUS_ONLINE and node.online_since: try: diff = datetime.now(timezone.utc) - datetime.fromisoformat(node.online_since) @@ -64,11 +64,11 @@ def task_runner(task): except Exception as e: logger.error(f"Failed to get online since: {e}") - migration_devices = 0 + migration_devices = [] if "migration_devices" in task.function_params: migration_devices = task.function_params["migration_devices"] - if current_online_devices < migration_devices: + if len(current_online_devices) < len(migration_devices): task.function_result = f"only {current_online_devices} devices online, waiting for more devices to be online" task.status = JobSchedule.STATUS_SUSPENDED task.retry += 1 @@ -83,11 +83,11 @@ def task_runner(task): rpc_client = RPCClient(snode.mgmt_ip, snode.rpc_port, snode.rpc_username, snode.rpc_password, timeout=5, retry=2) if "migration" not in task.function_params: - current_online_devices = 0 + current_online_devices = [] for node in db.get_storage_nodes_by_cluster_id(task.cluster_id): for dev in node.nvme_devices: if dev.status == NVMeDevice.STATUS_ONLINE: - current_online_devices += 1 + current_online_devices.append(dev.get_id()) distr_name = task.function_params["distr_name"] From 632d4275ee0eee975eff6dc9a6e369f79c51aefa Mon Sep 17 00:00:00 2001 From: hamdykhader Date: Tue, 3 Mar 2026 19:41:46 +0300 Subject: [PATCH 2/3] tmp migration: store devices ids on which the migrations is running Compare the devices for any status change and run migration again --- simplyblock_core/services/tasks_runner_migration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simplyblock_core/services/tasks_runner_migration.py b/simplyblock_core/services/tasks_runner_migration.py index 26bece72b..21611d6cb 100644 --- a/simplyblock_core/services/tasks_runner_migration.py +++ b/simplyblock_core/services/tasks_runner_migration.py @@ -68,8 +68,8 @@ def task_runner(task): if "migration_devices" in task.function_params: migration_devices = task.function_params["migration_devices"] - if len(current_online_devices) < len(migration_devices): - task.function_result = f"only {current_online_devices} devices online, waiting for more devices to be online" + if current_online_devices == migration_devices: + task.function_result = f"Waiting for more devices to be online" task.status = JobSchedule.STATUS_SUSPENDED task.retry += 1 task.write_to_db(db.kv_store) From fb5567eb3d32c18929859ecf70bd287705d2cbdf Mon Sep 17 00:00:00 2001 From: hamdykhader Date: Tue, 3 Mar 2026 21:05:59 +0300 Subject: [PATCH 3/3] fix linter --- simplyblock_core/services/tasks_runner_migration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplyblock_core/services/tasks_runner_migration.py b/simplyblock_core/services/tasks_runner_migration.py index 21611d6cb..1e9f2b828 100644 --- a/simplyblock_core/services/tasks_runner_migration.py +++ b/simplyblock_core/services/tasks_runner_migration.py @@ -69,7 +69,7 @@ def task_runner(task): migration_devices = task.function_params["migration_devices"] if current_online_devices == migration_devices: - task.function_result = f"Waiting for more devices to be online" + task.function_result = "Waiting for more devices to be online" task.status = JobSchedule.STATUS_SUSPENDED task.retry += 1 task.write_to_db(db.kv_store)