[PATCH compass-ci 1/3] qemu/kvm.sh: fix script will hang when there is no job

[Error Msg] ++ set_initrd ++ initrd=initrd ++ cat <<< hang here [Root Cause] Function set_initrd() have follow line: cat $initrds > $initrd When there is no job corresponding to current vm in the remote redis queue, var $initrds will be equal to "". And from `cat --help`, we can know the follow: cat Copy standard input to standard output. So the process will get stuck waiting for input. [How] Function check_option_value() is used to check whether $initrds or $kernel is empty. And $initrds and $kernel are assigned in the function parse_ipxe_script(). So move check_option_value() before set_initrd(). Signed-off-by: Yu Chuan <13186087857@163.com> --- providers/qemu/kvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 854e9138a7c0..35678fbd44ef 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -197,8 +197,8 @@ write_logfile parse_ipxe_script -set_options check_option_value +set_options print_message -- 2.23.0

On Fri, Jan 15, 2021 at 05:59:17PM +0800, Yu Chuan wrote:
[Error Msg] ++ set_initrd ++ initrd=initrd ++ cat <<< hang here
[Root Cause] Function set_initrd() have follow line: cat $initrds > $initrd
When there is no job corresponding to current vm in the remote redis queue, var $initrds will be equal to "".
And from `cat --help`, we can know the follow: cat Copy standard input to standard output.
So the process will get stuck waiting for input.
[How] Function check_option_value() is used to check whether $initrds or $kernel is empty.
And $initrds and $kernel are assigned in the function parse_ipxe_script().
So move check_option_value() before set_initrd().
do you have test? Thanks, Yinsi
Signed-off-by: Yu Chuan <13186087857@163.com> --- providers/qemu/kvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 854e9138a7c0..35678fbd44ef 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -197,8 +197,8 @@ write_logfile
parse_ipxe_script
-set_options check_option_value +set_options
print_message
-- 2.23.0

On Fri, Jan 15, 2021 at 06:15:03PM +0800, Liu Yinsi wrote:
On Fri, Jan 15, 2021 at 05:59:17PM +0800, Yu Chuan wrote:
[Error Msg] ++ set_initrd ++ initrd=initrd ++ cat <<< hang here
[Root Cause] Function set_initrd() have follow line: cat $initrds > $initrd
When there is no job corresponding to current vm in the remote redis queue, var $initrds will be equal to "".
And from `cat --help`, we can know the follow: cat Copy standard input to standard output.
So the process will get stuck waiting for input.
[How] Function check_option_value() is used to check whether $initrds or $kernel is empty.
And $initrds and $kernel are assigned in the function parse_ipxe_script().
So move check_option_value() before set_initrd().
do you have test?
Yeap, it will hang every time. -------- Thanks Yu Chuan
Thanks, Yinsi
Signed-off-by: Yu Chuan <13186087857@163.com> --- providers/qemu/kvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 854e9138a7c0..35678fbd44ef 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -197,8 +197,8 @@ write_logfile
parse_ipxe_script
-set_options check_option_value +set_options
print_message
-- 2.23.0

On Fri, Jan 15, 2021 at 05:59:17PM +0800, Yu Chuan wrote:
[Error Msg] ++ set_initrd ++ initrd=initrd ++ cat <<< hang here
[Root Cause] Function set_initrd() have follow line: cat $initrds > $initrd
When there is no job corresponding to current vm in the remote redis queue, var $initrds will be equal to "".
And from `cat --help`, we can know the follow: cat Copy standard input to standard output.
So the process will get stuck waiting for input.
[How] Function check_option_value() is used to check whether $initrds or $kernel is empty.
And $initrds and $kernel are assigned in the function parse_ipxe_script().
So move check_option_value() before set_initrd().
Signed-off-by: Yu Chuan <13186087857@163.com> --- providers/qemu/kvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 854e9138a7c0..35678fbd44ef 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -197,8 +197,8 @@ write_logfile
parse_ipxe_script
-set_options check_option_value +set_options
check_option_value have check qemu command, if set_options after check, check_option_value doesn't work for qemu command, the order can like this: parse_ipxe_script set_qemu check_option_value set_options Thanks, Yinsi
print_message
-- 2.23.0

@@ -197,8 +197,8 @@ write_logfile
parse_ipxe_script
-set_options check_option_value +set_options
check_option_value have check qemu command, if set_options after check, check_option_value doesn't work for qemu command, the order can like this:
parse_ipxe_script set_qemu check_option_value set_options
Good, so how about move the follow line from check_option_value() to set_qemu() ? [[ $kernel =~ 'riscv64' ]] && qemu=qemu-system-riscv64 Because it looks a set qemu step, and ,when run set_qemu(), we already get var $kernel. -------- Thanks Yu Chuan
Thanks, Yinsi
print_message
-- 2.23.0

On Fri, Jan 15, 2021 at 07:22:50PM +0800, Yu Chuan wrote:
@@ -197,8 +197,8 @@ write_logfile
parse_ipxe_script
-set_options check_option_value +set_options
check_option_value have check qemu command, if set_options after check, check_option_value doesn't work for qemu command, the order can like this:
parse_ipxe_script set_qemu check_option_value set_options
Good, so how about move the follow line from check_option_value() to set_qemu() ? [[ $kernel =~ 'riscv64' ]] && qemu=qemu-system-riscv64
Because it looks a set qemu step, and ,when run set_qemu(), we already get var $kernel.
move it or not can refer: Subject: Re: [PATCH v8 compass-ci] providers/qemu: adapt for x86_64 and riscv64 Subject: [PATCH v2 compass-ci 3/3] providers/qemu: check kernel because check kernel and set qemu is not the same logic, so not move. Thanks, Yinsi
-------- Thanks Yu Chuan
Thanks, Yinsi
print_message
-- 2.23.0

On Mon, Jan 18, 2021 at 01:11:44PM +0800, Liu Yinsi wrote:
On Fri, Jan 15, 2021 at 07:22:50PM +0800, Yu Chuan wrote:
@@ -197,8 +197,8 @@ write_logfile
parse_ipxe_script
-set_options check_option_value +set_options
check_option_value have check qemu command, if set_options after check, check_option_value doesn't work for qemu command, the order can like this:
parse_ipxe_script set_qemu check_option_value set_options
Good, so how about move the follow line from check_option_value() to set_qemu() ? [[ $kernel =~ 'riscv64' ]] && qemu=qemu-system-riscv64
Because it looks a set qemu step, and ,when run set_qemu(), we already get var $kernel.
move it or not can refer:
Subject: Re: [PATCH v8 compass-ci] providers/qemu: adapt for x86_64 and riscv64
Subject: [PATCH v2 compass-ci 3/3] providers/qemu: check kernel
because check kernel and set qemu is not the same logic, so not move.
Well, so how to handle the 'no job now' state? The current code will hang every time. -------- Thanks Yu Chuan
Thanks, Yinsi
-------- Thanks Yu Chuan
Thanks, Yinsi
print_message
-- 2.23.0
participants (2)
-
Liu Yinsi
-
Yu Chuan