[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 | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/lib/sched_client.rb b/lib/sched_client.rb index fec4b14..a81ffbb 100644 --- a/lib/sched_client.rb +++ b/lib/sched_client.rb @@ -16,4 +16,41 @@ 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 + + def register_mac2host(hostname, mac) + @hostname = hostname + @mac = mac + RestClient.put( + "http://#%7B@host%7D:#%7B@port%7D/set_host_mac?hostname=#%7B@hostname%7D&...", {} + ) + end + + def register_host2queues(hostname, queues) + @hostname = hostname + @queues = queues + RestClient.put( + "http://#%7B@host%7D:#%7B@port%7D/set_host2queues?host=#%7B@hostname%7D&q...", {} + ) + end + + def delete_mac2host + RestClient.put( + "http://#%7B@host%7D:#%7B@port%7D/del_host_mac?mac=#%7B@mac%7D", {} + ) + end + + def delete_host2queues + RestClient.put( + "http://#%7B@host%7D:#%7B@port%7D/del_host2queues?host=#%7B@hostname%7D", {} + ) + end end
On Tue, Jan 26, 2021 at 10:43:29AM +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 | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/lib/sched_client.rb b/lib/sched_client.rb index fec4b14..a81ffbb 100644 --- a/lib/sched_client.rb +++ b/lib/sched_client.rb @@ -16,4 +16,41 @@ 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
- 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}", {}
Use @mac will limit call the function, as the params will be better.
Thanks, Xueliang
- )
- end
- def delete_host2queues
- RestClient.put(
"http://#{@host}:#{@port}/del_host2queues?host=#{@hostname}", {}
- )
- end
end
2.23.0
- @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}", {}
Use @mac will limit call the function, as the params will be better.
good
i will remove them to ensure the independence of the method
Thanks, Shenwei
Thanks, Xueliang
- )
- end
- def delete_host2queues
- RestClient.put(
"http://#{@host}:#{@port}/del_host2queues?host=#{@hostname}", {}
- )
- end
end
2.23.0