@@ -52,6 +52,11 @@ def _add_task(function_name, cluster_id, node_id, device_id,
52
52
if task_id :
53
53
logger .info (f"Task found, skip adding new task: { task_id } " )
54
54
return False
55
+ elif function_name == JobSchedule .FN_DEV_MIG :
56
+ task_id = get_device_mig_task (cluster_id , node_id , function_params ['distr_name' ])
57
+ if task_id :
58
+ logger .info (f"Task found, skip adding new task: { task_id } " )
59
+ return False
55
60
56
61
task_obj = JobSchedule ()
57
62
task_obj .uuid = str (uuid .uuid4 ())
@@ -72,6 +77,8 @@ def _add_task(function_name, cluster_id, node_id, device_id,
72
77
def add_device_mig_task (device_id ):
73
78
device = db_controller .get_storage_devices (device_id )
74
79
for node in db_controller .get_storage_nodes_by_cluster_id (device .cluster_id ):
80
+ if not node .lvols :
81
+ continue
75
82
for bdev in node .lvstore_stack :
76
83
if bdev ['type' ] == "bdev_distr" :
77
84
_add_task (JobSchedule .FN_DEV_MIG , device .cluster_id , node .get_id (), device .get_id (),
@@ -190,6 +197,7 @@ def get_active_node_task(cluster_id, node_id):
190
197
return task .uuid
191
198
return False
192
199
200
+
193
201
def get_new_device_mig_task (cluster_id , node_id , distr_name ):
194
202
tasks = db_controller .get_job_tasks (cluster_id )
195
203
for task in tasks :
@@ -198,3 +206,13 @@ def get_new_device_mig_task(cluster_id, node_id, distr_name):
198
206
and "distr_name" in task .function_params and task .function_params ["distr_name" ] == distr_name :
199
207
return task .uuid
200
208
return False
209
+
210
+
211
+ def get_device_mig_task (cluster_id , node_id , distr_name ):
212
+ tasks = db_controller .get_job_tasks (cluster_id )
213
+ for task in tasks :
214
+ if task .function_name == JobSchedule .FN_DEV_MIG and task .node_id == node_id :
215
+ if task .status != JobSchedule .STATUS_DONE and task .canceled is False \
216
+ and "distr_name" in task .function_params and task .function_params ["distr_name" ] == distr_name :
217
+ return task .uuid
218
+ return False
0 commit comments