Skip to contentSkip to conversation

arch-run: migration: properly handle crashing outgoing QEMU

PATCH In review Nico Boehr 2 participants 3 messages Sep 26, 2023 – Oct 9, 2023

Subsystems (2)
lore
Share & tools
lore

Nico Boehr

author
#0 lore raw

PATCH 1/1 arch-run: migration: properly handle crashing outgoing QEMU

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.

---
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(-)
scripts/arch-run.bash +8 -2
index 518607f4b75d..de9890408e24 100644
@@ -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
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Nico Boehr

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.

---
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(-)
scripts/arch-run.bash +1 -2
index 518607f4b75d..de9890408e24 100644
@@ -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

scripts/arch-run.bash run_migration () · line 175

Quoted 10 lines
scripts/arch-run.bash +7 -0
+			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

and pushed to the repository.