[PATCH compass-ci] fix: sched: set 2 fields to job: direct_macs, direct_ips

cluster nodes need communicate with each other, so set 2 fields: 1) direct_macs: get from cluster file ($LKP_SRC/cluster/*) 2) direct_ips: set by scheduler default (they're local ips) It will add ips to corresponding devices before nodes executing jobs. Signed-off-by: Ren Wen <15991987063@163.com> --- src/lib/sched.cr | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/sched.cr b/src/lib/sched.cr index a18bdee..62b7b9d 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -198,6 +198,11 @@ class Sched # collect all job ids job_ids = [] of String + # set net id, and host id + # ip = net_id + set_id + net_id = "192.168.211." + host_id = 1 + # steps for each host cluster_config.each do |host, config| tbox_group = host.to_s @@ -219,7 +224,16 @@ class Sched job["testbox"] = tbox_group job.update_tbox_group(tbox_group) job["node_roles"] = config["roles"].as_a.join(" ") - job["node_macs"] = config["macs"].as_a.join(" ") + + # host macs and host ips + direct_macs = config["macs"].as_a + direct_ips = [] of String + direct_macs.size.times do + direct_ips << "#{net_id}#{host_id}" + host_id += 1 + end + job["direct_macs"] = direct_macs.join(" ") + job["direct_ips"] = direct_ips.join(" ") response = add_job(job, job_id) message = (response["error"]? ? response["error"]["root_cause"] : "") -- 2.23.0

On Mon, Oct 19, 2020 at 08:06:53PM +0800, Ren Wen wrote:
cluster nodes need communicate with each other, so set 2 fields: 1) direct_macs: get from cluster file ($LKP_SRC/cluster/*) 2) direct_ips: set by scheduler default (they're local ips)
It will add ips to corresponding devices before nodes executing jobs.
Signed-off-by: Ren Wen <15991987063@163.com> --- src/lib/sched.cr | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index a18bdee..62b7b9d 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -198,6 +198,11 @@ class Sched # collect all job ids job_ids = [] of String
+ # set net id, and host id + # ip = net_id + set_id + net_id = "192.168.211." + host_id = 1
It's too easy conflict if the net_id and host_id are fixed. Thanks, Xueliang
+ # steps for each host cluster_config.each do |host, config| tbox_group = host.to_s @@ -219,7 +224,16 @@ class Sched job["testbox"] = tbox_group job.update_tbox_group(tbox_group) job["node_roles"] = config["roles"].as_a.join(" ") - job["node_macs"] = config["macs"].as_a.join(" ") + + # host macs and host ips + direct_macs = config["macs"].as_a + direct_ips = [] of String + direct_macs.size.times do + direct_ips << "#{net_id}#{host_id}" + host_id += 1 + end + job["direct_macs"] = direct_macs.join(" ") + job["direct_ips"] = direct_ips.join(" ")
response = add_job(job, job_id) message = (response["error"]? ? response["error"]["root_cause"] : "") -- 2.23.0
participants (2)
-
Cao Xueliang
-
Ren Wen