Requested by: curl 'http://<SCHED_HOST>:<SCHED_PORT>/boot.libvirt/mac/<mac>'
Response some job fields in json format: - job_id - kernel_uri - kernel_params - initrds_uri - result_root - LKP_SERVER - templates (provided by libvirt)
Signed-off-by: Ren Wen 15991987063@163.com --- src/scheduler/find_job_boot.cr | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index 5e6044a..625c74c 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -7,7 +7,7 @@ class Sched boot_type = @env.params.url["boot_type"]
case boot_type - when "ipxe" + when "ipxe", "libvirt" host = @redis.hash_get("sched/mac2host", normalize_mac(value)) when "grub" host = @redis.hash_get("sched/mac2host", normalize_mac(value)) @@ -170,6 +170,22 @@ class Sched return response end
+ private def get_boot_libvirt(job : Job) + _kernel_params = job["kernel_params"]? + _kernel_params = _kernel_params.as_a.map(&.to_s).join(" ") if _kernel_params + + return { + "job_id" => job.id, + "kernel_uri" => job.kernel_uri, + "initrds_uri" => job["initrds_uri"]?, + "kernel_params" => _kernel_params, + "result_root" => job.result_root, + "LKP_SERVER" => job["LKP_SERVER"]?, + "templates" => job["templates"]?, + "RESULT_WEBDAV_PORT" => job["RESULT_WEBDAV_PORT"]? || "3080", + }.to_json + end + def set_id2upload_dirs(job) @redis.hash_set("sched/id2upload_dirs", job.id, job.upload_dirs) end @@ -184,6 +200,8 @@ class Sched return job ? get_boot_grub(job) : grub_msg("No job now") when "container" return job ? get_boot_container(job) : Hash(String, String).new.to_json + when "libvirt" + return job ? get_boot_libvirt(job) : {"job_id" => ""}.to_json else raise "Not defined boot type #{boot_type}" end