Signed-off-by: Wu Fengguang <wfg(a)mail.ustc.edu.cn>
---
src/lib/job.cr | 31 +----------------------------
src/scheduler/kernel_params.cr | 36 ++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 30 deletions(-)
create mode 100644 src/scheduler/kernel_params.cr
diff --git a/src/lib/job.cr b/src/lib/job.cr
index 7fbc414..0fd57e0 100644
--- a/src/lib/job.cr
+++ b/src/lib/job.cr
@@ -7,6 +7,7 @@ require "any_merge"
require "scheduler/constants.cr"
require "scheduler/jobfile_operate.cr"
+require "scheduler/kernel_params.cr"
struct JSON::Any
def []=(key : String, value : String)
@@ -297,10 +298,6 @@ class Job
"#{JobHelper.service_path("#{SRV_OS}/#{os_dir}/vmlinuz")}"
end
- private def kernel_common_params
- return "user=lkp job=/lkp/scheduled/job.yaml RESULT_ROOT=/result/job rootovl ip=dhcp ro"
- end
-
private def common_initrds
temp_initrds = [] of String
@@ -369,32 +366,6 @@ class Job
self["initrds_uri"] = uris
end
- private def set_kernel_append_root
- os_real_path = JobHelper.service_path("#{SRV_OS}/#{os_dir}")
-
- fs2root = {
- "nfs" => "root=#{OS_HTTP_HOST}:#{os_real_path} #{initrds_basename()}",
- "cifs" => "root=cifs://#{OS_HTTP_HOST}#{os_real_path}" +
- ",guest,ro,hard,vers=1.0,noacl,nouser_xattr #{initrds_basename()}",
- "initramfs" => "rdinit=/sbin/init prompt_ramdisk=0 #{initrds_basename()}",
- "container" => "",
- }
-
- self["kernel_append_root"] = fs2root[os_mount]
- end
-
- private def kernel_console
- if os_arch == "x86_64"
- return "console=ttyS0,115200 console=tty0"
- else
- return ""
- end
- end
-
- private def set_kernel_params
- self["kernel_params"] = " #{kernel_common_params()} #{kernel_append_root} #{kernel_console()}"
- end
-
private def set_user_lkp_src
lkp_arch_cgz = "#{SRV_INITRD}/lkp/#{lkp_initrd_user}/lkp-#{os_arch}.cgz"
raise "The #{lkp_arch_cgz} does not exist." unless File.exists?(lkp_arch_cgz)
diff --git a/src/scheduler/kernel_params.cr b/src/scheduler/kernel_params.cr
new file mode 100644
index 0000000..54438b5
--- /dev/null
+++ b/src/scheduler/kernel_params.cr
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: MulanPSL-2.0+
+# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+
+class Job
+
+ private def kernel_common_params
+ return "user=lkp job=/lkp/scheduled/job.yaml RESULT_ROOT=/result/job rootovl ip=dhcp ro"
+ end
+
+ private def set_kernel_append_root
+ os_real_path = JobHelper.service_path("#{SRV_OS}/#{os_dir}")
+
+ fs2root = {
+ "nfs" => "root=#{OS_HTTP_HOST}:#{os_real_path} #{initrds_basename()}",
+ "cifs" => "root=cifs://#{OS_HTTP_HOST}#{os_real_path}" +
+ ",guest,ro,hard,vers=1.0,noacl,nouser_xattr #{initrds_basename()}",
+ "initramfs" => "rdinit=/sbin/init prompt_ramdisk=0 #{initrds_basename()}",
+ "container" => "",
+ }
+
+ self["kernel_append_root"] = fs2root[os_mount]
+ end
+
+ private def kernel_console
+ if os_arch == "x86_64"
+ return "console=ttyS0,115200 console=tty0"
+ else
+ return ""
+ end
+ end
+
+ private def set_kernel_params
+ self["kernel_params"] = " #{kernel_common_params()} #{kernel_append_root} #{kernel_console()}"
+ end
+
+end
--
2.23.0