[Why] nodes need communicate with each other when running cluster jobs. after adding 2 fileds, 'direct_ips' and 'direct_macs', can bind ips to macs.
'macs' get from cluster file ('$LKP_SRC/cluster/*'), 'ips' set by scheduler default.
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..82d3610 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -198,6 +198,10 @@ class Sched # collect all job ids job_ids = [] of String
+ # used to set ips + ip_prefix = "192.169." + host_id = 1 + # steps for each host cluster_config.each do |host, config| tbox_group = host.to_s @@ -219,7 +223,17 @@ 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 + net_id = "#{ip_prefix}#{job_id.hash%255}" # 192.169.<0..254> + 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"] : "")
Please ignore this mail.
On Tue, Oct 20, 2020 at 10:39:35AM +0800, Ren Wen wrote:
[Why] nodes need communicate with each other when running cluster jobs. after adding 2 fileds, 'direct_ips' and 'direct_macs', can bind ips to macs.
'macs' get from cluster file ('$LKP_SRC/cluster/*'), 'ips' set by scheduler default.
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..82d3610 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -198,6 +198,10 @@ class Sched # collect all job ids job_ids = [] of String
- # used to set ips
- ip_prefix = "192.169."
- host_id = 1
- # steps for each host cluster_config.each do |host, config| tbox_group = host.to_s
@@ -219,7 +223,17 @@ 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
net_id = "#{ip_prefix}#{job_id.hash%255}" # 192.169.<0..254>
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