diff mbox series

[kvm-unit-tests,v1] arch-run: migration: properly handle crashing outgoing QEMU

Message ID 20230926120828.1830840-1-nrb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests,v1] arch-run: migration: properly handle crashing outgoing QEMU | expand

Commit Message

Nico Boehr Sept. 26, 2023, 12:08 p.m. UTC
When outgoing (live) QEMU crashes or times out during migration, we
currently hang forever.

This is because we don't exit the loop querying migration state when QMP
communication fails.

Add proper error handling to the loop and exit when QMP communication
fails for whatever reason.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
Sorry I accidentally sent this only to s390x maintainers and forgot
Paolo and Andrew, hence resending.

 scripts/arch-run.bash | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Thomas Huth Oct. 9, 2023, 11:29 a.m. UTC | #1
On 26/09/2023 14.08, Nico Boehr wrote:
> When outgoing (live) QEMU crashes or times out during migration, we
> currently hang forever.
> 
> This is because we don't exit the loop querying migration state when QMP
> communication fails.
> 
> Add proper error handling to the loop and exit when QMP communication
> fails for whatever reason.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
> Sorry I accidentally sent this only to s390x maintainers and forgot
> Paolo and Andrew, hence resending.
> 
>   scripts/arch-run.bash | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> index 518607f4b75d..de9890408e24 100644
> --- a/scripts/arch-run.bash
> +++ b/scripts/arch-run.bash
> @@ -162,8 +162,14 @@ run_migration ()
>   	migstatus=`qmp ${qmp1} '"query-migrate"' | grep return`
>   	while ! grep -q '"completed"' <<<"$migstatus" ; do
>   		sleep 1
> -		migstatus=`qmp ${qmp1} '"query-migrate"' | grep return`
> -		if grep -q '"failed"' <<<"$migstatus" ; then
> +		if ! migstatus=`qmp ${qmp1} '"query-migrate"'`; then
> +			echo "ERROR: Querying migration state failed." >&2
> +			echo > ${fifo}
> +			qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null
> +			return 2
> +		fi
> +		migstatus=`grep return <<<"$migstatus"`
> +		if grep -q '"failed"' <<<"$migstatus"; then
>   			echo "ERROR: Migration failed." >&2
>   			echo > ${fifo}
>   			qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null

Reviewed-by: Thomas Huth <thuth@redhat.com>

and pushed to the repository.
Nico Boehr Oct. 9, 2023, 2:33 p.m. UTC | #2
Quoting Thomas Huth (2023-10-09 13:29:38)
[...]
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> and pushed to the repository.

 Thanks!
diff mbox series

Patch

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 518607f4b75d..de9890408e24 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -162,8 +162,14 @@  run_migration ()
 	migstatus=`qmp ${qmp1} '"query-migrate"' | grep return`
 	while ! grep -q '"completed"' <<<"$migstatus" ; do
 		sleep 1
-		migstatus=`qmp ${qmp1} '"query-migrate"' | grep return`
-		if grep -q '"failed"' <<<"$migstatus" ; then
+		if ! migstatus=`qmp ${qmp1} '"query-migrate"'`; then
+			echo "ERROR: Querying migration state failed." >&2
+			echo > ${fifo}
+			qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null
+			return 2
+		fi
+		migstatus=`grep return <<<"$migstatus"`
+		if grep -q '"failed"' <<<"$migstatus"; then
 			echo "ERROR: Migration failed." >&2
 			echo > ${fifo}
 			qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null