On Tue, Jan 26, 2021 at 10:33:30AM +0800, Cao Xueliang wrote:
On Tue, Jan 26, 2021 at 10:25:24AM +0800, Xiao Shenwei wrote:
[why] we have some providers: ipxe, container, libvirt
all of them need register testbox info and consume job from scheduler
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
lib/sched_client.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/lib/sched_client.rb b/lib/sched_client.rb index fec4b14..b317790 100644 --- a/lib/sched_client.rb +++ b/lib/sched_client.rb @@ -16,4 +16,43 @@ class SchedClient resource = RestClient::Resource.new("http://#%7B@host%7D:#%7B@port%7D/submit_job") resource.post(job_json) end
- # scheduler API /boot.:boot_type/:parameter/:value
- # boot_type parameter
- # 1 ipxe mac
- # 2 container hostname
- # 3 libvirt mac
- def consume_job(boot_type, parameter, value)
- RestClient.get "http://#%7B@host%7D:#%7B@port%7D/boot.#%7Bboot_type%7D/#%7Bparameter%7D/#%7B..."
- end
- # some provider only need register host2queues
- # like boot.container
The comment looks like not match with the function, why add it at here?
good
for ipxe and libvirt need register_mac2host register_host2queues, at first i merge then to register, but i find container only need register_host2queues, so split it.
for scheduler mac2host host2queues are single api, so new 2 methods is normal
i will delete it
Thanks, Shenwei
Thanks, Xueliang
- def register_mac2host(hostname, mac)
- @hostname = hostname
- @mac = mac
- RestClient.put(
"http://#{@host}:#{@port}/set_host_mac?hostname=#{@hostname}&mac=#{@mac}", {}
- )
- end
- def register_host2queues(hostname, queues)
- @hostname = hostname
- @queues = queues
- RestClient.put(
"http://#{@host}:#{@port}/set_host2queues?host=#{@hostname}&queues=#{@queues}", {}
- )
- end
- def delete_mac2host
- RestClient.put(
"http://#{@host}:#{@port}/del_host_mac?mac=#{@mac}", {}
- )
- end
- def delete_host2queues
- RestClient.put(
"http://#{@host}:#{@port}/del_host2queues?host=#{@hostname}", {}
- )
- end
end
2.23.0