On Thu, Oct 29, 2020 at 04:38:21PM +0800, Wu Fengguang wrote:
On Thu, Oct 29, 2020 at 02:54:05PM +0800, Xiao Shenwei wrote:
On Thu, Oct 29, 2020 at 02:38:04PM +0800, Wu Fengguang wrote:
How about the dc-* machines? They don't have mac, only hostname.
solution-1: hostname2queues register hostname and queuesi relation
That looks better. We have to map mac to host anyway.
We have mac2host:
+ testbox = @redis.hash_get("sched/mac2host", normalize_mac(value))
So host2queues can be universally applicable for dc-* and vm-* and HW machines.
hostname2queues => host2queues
Thanks, Fengguang
solution-2: based on hostname generate mac, then mac2queues
which one can be used ? and have other idea?
Thanks, Shenwei
Thanks, Fengguang
On Thu, Oct 29, 2020 at 09:51:32AM +0800, Xiao Shenwei wrote:
[why] the test machine has the ability to know which queues should be requested.
[how] create API for register or del mac and queues relation
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
src/lib/sched.cr | 8 ++++++++ src/scheduler/scheduler.cr | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index c32091f..8aca46b 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -34,10 +34,18 @@ class Sched @redis.hash_set("sched/mac2host", normalize_mac(mac), hostname) end
def set_mac2queues(mac : String, queues : String)
@redis.hash_set("sched/mac2queues", normalize_mac(mac), queues)
end
def del_host_mac(mac : String) @redis.hash_del("sched/mac2host", normalize_mac(mac)) end
def del_mac2queues(mac : String)
@redis.hash_del("sched/mac2queues", normalize_mac(mac))
end
# return: # Hash(String, Hash(String, String)) def get_cluster_state(cluster_id)
diff --git a/src/scheduler/scheduler.cr b/src/scheduler/scheduler.cr index 371e4ed..21a2a51 100644 --- a/src/scheduler/scheduler.cr +++ b/src/scheduler/scheduler.cr @@ -113,6 +113,18 @@ module Scheduler end end
- # curl -X PUT "http://localhost:3000/set_mac2queues?queues=vm-2p8g.aarch64&mac=00-01-02..."
- put "/set_mac2queues" do |env|
- env.response.headers["Connection"] = "close"
- if (client_queues = env.params.query["queues"]?) && (client_mac = env.params.query["mac"]?)
sched.set_mac2queues(client_mac, client_queues)
"Done"
- else
"No yet"
- end
- end
- # curl -X PUT "http://localhost:3000/del_host_mac?mac=00-01-02-03-04-05" put "/del_host_mac" do |env| env.response.headers["Connection"] = "close"
@@ -125,6 +137,18 @@ module Scheduler end end
- # curl -X PUT "http://localhost:3000/del_mac2queues?mac=00-01-02-03-04-05"
- put "/del_mac2queues" do |env|
- env.response.headers["Connection"] = "close"
- if client_mac = env.params.query["mac"]?
sched.del_mac2queues(client_mac)
"Done"
- else
"No yet!"
- end
- end
- # client(runner) report job's status # /~lkp/cgi-bin/lkp-jobfile-append-var # ?job_file=/lkp/scheduled/job.yaml&job_state=running&job_id=10
-- 2.23.0