Fix savevm/loadvm after postcopy migration
v3 cover Fix savevm/loadvm after postcopy migration
v3:
- patch 1: added 'Reported-by' info in the commit msg. No code changes were made.
- patch 2 *new*: a new qemu-iotest that verifies the behavior fixed in patch1.
v2:
- added helper functions to simplify the code
Daniel Henrique Barboza (2):
migration/ram.c: do not set 'postcopy_running' in
POSTCOPY_INCOMING_END
tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
migration/ram.c | 16 ++++++- tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 4 files changed, 145 insertions(+), 2 deletions(-) create mode 100755 tests/qemu-iotests/198 create mode 100644 tests/qemu-iotests/198.out
Signature · 1 line
2.13.6
PATCH v3 1/2 migration/ram.c: do not set 'postcopy_running' in POSTCOPY_INCOMING_END
When migrating a VM with 'migrate_set_capability postcopy-ram on' a postcopy_state is set during the process, ending up with the state POSTCOPY_INCOMING_END when the migration is over. This postcopy_state is taken into account inside ram_load to check how it will load the memory pages. This same ram_load is called when in a loadvm command.
Inside ram_load, the logic to see if we're at postcopy_running state is:
postcopy_running = postcopy_state_get() >= POSTCOPY_INCOMING_LISTENING
postcopy_state_get() returns this enum type:
typedef enum {
POSTCOPY_INCOMING_NONE = 0,
POSTCOPY_INCOMING_ADVISE,
POSTCOPY_INCOMING_DISCARD,
POSTCOPY_INCOMING_LISTENING,
POSTCOPY_INCOMING_RUNNING,
POSTCOPY_INCOMING_END
} PostcopyState;
In the case where ram_load is executed and postcopy_state is POSTCOPY_INCOMING_END, postcopy_running will be set to 'true' and ram_load will behave like a postcopy is in progress. This scenario isn't achievable in a migration but it is reproducible when executing savevm/loadvm after migrating with 'postcopy-ram on', causing loadvm to fail with Error -22:
Source:
(qemu) migrate_set_capability postcopy-ram on
(qemu) migrate tcp:127.0.0.1:4444
Dest:
(qemu) migrate_set_capability postcopy-ram on
(qemu)
ubuntu1704-intel login:
Ubuntu 17.04 ubuntu1704-intel ttyS0
ubuntu1704-intel login: (qemu)
(qemu) savevm test1
(qemu) loadvm test1
Unknown combination of migration flags: 0x4 (postcopy mode) error while loading state for instance 0x0 of device 'ram' Error -22 while loading VM state
(qemu)
This patch fixes this problem by changing the existing logic for postcopy_advised and postcopy_running in ram_load, making them 'false' if we're at POSTCOPY_INCOMING_END state.
--- migration/ram.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
migration/ram.c +14 -2
@@ -2798,6 +2798,18 @@ static int ram_load_postcopy(QEMUFile *f)return ret; } +static bool postcopy_is_advised (void ) +{ +PostcopyState ps =postcopy_state_get (); +return ps >=POSTCOPY_INCOMING_ADVISE && ps <POSTCOPY_INCOMING_END ; +} + +static bool postcopy_is_running (void ) +{ +PostcopyState ps =postcopy_state_get (); +return ps >=POSTCOPY_INCOMING_LISTENING && ps <POSTCOPY_INCOMING_END ; +} +static int ram_load (QEMUFile *f,void *opaque,int version_id) {int flags =0 , ret =0 , invalid_flags =0 ;
@@ -2807,9 +2819,9 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)* If system is running in postcopy mode, page inserts to host memory must * be atomic */ -bool postcopy_running =postcopy_state_get () >=POSTCOPY_INCOMING_LISTENING ; +bool postcopy_running =postcopy_is_running ();/* ADVISE is earlier, it shows the source has the postcopy capability on */ -bool postcopy_advised =postcopy_state_get () >=POSTCOPY_INCOMING_ADVISE ; +bool postcopy_advised =postcopy_is_advised (); seq_iter++;
Signature · 1 line
2.13.6
PATCH v3 2/2 tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
In reply to Daniel Henrique BarbozaThis patch implements a test case for the scenario that was failing prior to the patch "migration/ram.c: do not set 'postcopy_running' in POSTCOPY_INCOMING_END".
This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+) create mode 100755 tests/qemu-iotests/198 create mode 100644 tests/qemu-iotests/198.out
tests/qemu-iotests/198 new file +110 -0
@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' and migrate === +echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)" + +echo +echo === On destination, execute savevm and loadvm === +echo + +silent= +_send_qemu_cmd $dest 'savevm state1"' "(qemu)" +_send_qemu_cmd $dest 'loadvm state1"' "(qemu)" + +echo +echo === Shut down and check image === +echo + +_send_qemu_cmd $src 'quit' "" +_send_qemu_cmd $dest 'quit' "" +wait=1 _cleanup_qemu + +_check_test_img + +# success, all done +echo "*** done" +status=0
tests/qemu-iotests/198.out new file +20 -0
@@ -0,0 +1,20 @@ +QA output created by 198 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 + +=== Starting VMs === + + +=== Set 'migrate_set_capability postcopy-ram on' and migrate === + + +=== On destination, execute savevm and loadvm === + +(qemu) savevm state1" +(qemu) loadvm state1" + +=== Shut down and check image === + +(qemu) quit +(qemu) quit +No errors were found on the image. +*** done
tests/qemu-iotests/group +1 -0
@@ -194,3 +194,4 @@ 194 rw auto migration quick 195 rw auto quick 197 rw auto quick +198 rw auto migration
Signature · 1 line
2.13.6
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
Quoted 12 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>
Quoted 6 lines
---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.
Your test looks like a positive review/validation of (some of) the changes proposed in the "[PATCH 00/10] I/O tests cleanups" indeed.
Thanks for noticing that and for the CC.
- Cleber.
Quoted 159 lines
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+) create mode 100755 tests/qemu-iotests/198 create mode 100644 tests/qemu-iotests/198.outtests/qemu-iotests/198 new file +110
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' and migrate === +echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)" + +echo +echo === On destination, execute savevm and loadvm === +echo + +silent= +_send_qemu_cmd $dest 'savevm state1"' "(qemu)" +_send_qemu_cmd $dest 'loadvm state1"' "(qemu)" + +echo +echo === Shut down and check image === +echo + +_send_qemu_cmd $src 'quit' "" +_send_qemu_cmd $dest 'quit' "" +wait=1 _cleanup_qemu + +_check_test_img + +# success, all done +echo "*** done" +status=0tests/qemu-iotests/198.out new file +20
-0@@ -0,0 +1,20 @@ +QA output created by 198 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 + +=== Starting VMs === + + +=== Set 'migrate_set_capability postcopy-ram on' and migrate === + + +=== On destination, execute savevm and loadvm === + +(qemu) savevm state1" +(qemu) loadvm state1" + +=== Shut down and check image === + +(qemu) quit +(qemu) quit +No errors were found on the image. +*** donetests/qemu-iotests/group +1
-0@@ -194,3 +194,4 @@ 194 rw auto migration quick 195 rw auto quick 197 rw auto quick +198 rw auto migration
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
Quoted 20 lines · Cleber Rosa
Quoted 12 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>Quoted 6 lines
---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.
Quoted 4 lines
Your test looks like a positive review/validation of (some of) the changes proposed in the "[PATCH 00/10] I/O tests cleanups" indeed.
Thanks for noticing that and for the CC.
No problem!
And unless I missed something, the only proposed change that wasn't applied here is the one from " [PATCH 04/10] qemu-iotests: include (source) filters from common.rc" because it relies on changes in tests/qemu-iotests/common.rc.
Daniel
Quoted 161 lines
- Cleber.
Quoted 159 lines
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+)create mode 100755 tests/qemu-iotests/198
create mode 100644 tests/qemu-iotests/198.outtests/qemu-iotests/198 new file +110
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' and migrate === +echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)" + +echo +echo === On destination, execute savevm and loadvm === +echo + +silent= +_send_qemu_cmd $dest 'savevm state1"' "(qemu)" +_send_qemu_cmd $dest 'loadvm state1"' "(qemu)" + +echo +echo === Shut down and check image === +echo + +_send_qemu_cmd $src 'quit' "" +_send_qemu_cmd $dest 'quit' "" +wait=1 _cleanup_qemu + +_check_test_img + +# success, all done +echo "*** done" +status=0tests/qemu-iotests/198.out new file +20
-0@@ -0,0 +1,20 @@ +QA output created by 198 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 + +=== Starting VMs === + + +=== Set 'migrate_set_capability postcopy-ram on' and migrate === + + +=== On destination, execute savevm and loadvm === + +(qemu) savevm state1" +(qemu) loadvm state1" + +=== Shut down and check image === + +(qemu) quit +(qemu) quit +No errors were found on the image. +*** donetests/qemu-iotests/group +1
-0@@ -194,3 +194,4 @@ 194 rw auto migration quick 195 rw auto quick 197 rw auto quick +198 rw auto migration
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
In reply to Daniel Henrique BarbozaQuoted 18 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.
Quoted 6 lines
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+) create mode 100755 tests/qemu-iotests/198 create mode 100644 tests/qemu-iotests/198.out
Looks good overall, just two nitpicks below.
Quoted 85 lines
tests/qemu-iotests/198 new file +78
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' and migrate ===
tests/qemu-iotests/198 line 88
Quoted 10 lines
tests/qemu-iotests/198 new file +10
-0+echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"
Would it make sense to query the migration status non-silently here, too, so that the test output would verify that it has actually succeeded?
(I suppose the savevm/loadvm coming up next would fail if the migration failed, but maybe if it's easy enough...)
tests/qemu-iotests/198 line 96
Quoted 8 lines
tests/qemu-iotests/198 new file +8
-0+ +echo +echo === On destination, execute savevm and loadvm === +echo + +silent= +_send_qemu_cmd $dest 'savevm state1"' "(qemu)" +_send_qemu_cmd $dest 'loadvm state1"' "(qemu)"
Any specific reason why the snapshot name has a trailing double quote?
Max
Quoted 50 lines
tests/qemu-iotests/198 new file +14
-0+ +echo +echo === Shut down and check image === +echo + +_send_qemu_cmd $src 'quit' "" +_send_qemu_cmd $dest 'quit' "" +wait=1 _cleanup_qemu + +_check_test_img + +# success, all done +echo "*** done" +status=0tests/qemu-iotests/198.out new file +20
-0@@ -0,0 +1,20 @@ +QA output created by 198 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 + +=== Starting VMs === + + +=== Set 'migrate_set_capability postcopy-ram on' and migrate === + + +=== On destination, execute savevm and loadvm === + +(qemu) savevm state1" +(qemu) loadvm state1" + +=== Shut down and check image === + +(qemu) quit +(qemu) quit +No errors were found on the image. +*** donetests/qemu-iotests/group +1
-0@@ -194,3 +194,4 @@ 194 rw auto migration quick 195 rw auto quick 197 rw auto quick +198 rw auto migration
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
Hi Max,
Quoted 124 lines · Max Reitz
Quoted 18 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.Quoted 6 lines
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+)create mode 100755 tests/qemu-iotests/198
create mode 100644 tests/qemu-iotests/198.outLooks good overall, just two nitpicks below.
Quoted 84 lines
tests/qemu-iotests/198 new file +78
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' and migrate ===tests/qemu-iotests/198 line 88
Quoted 10 lines
tests/qemu-iotests/198 new file +10
-0+echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"Would it make sense to query the migration status non-silently here, too, so that the test output would verify that it has actually succeeded?
Quoted 2 lines
(I suppose the savevm/loadvm coming up next would fail if the migration failed, but maybe if it's easy enough...)
Not exactly non-silently, but we can do something like this:
echo
echo === Check if migration was successful ===
echo
QEMU_COMM_TIMEOUT=1 silent=yes \
_send_qemu_cmd $src "info migrate" "completed" silent=yes _send_qemu_cmd $src "" "(qemu)"
If migration failed, the test will fail with timeout error waiting for "completed" prior to savevm. What do you think?
Quoted 10 lines
tests/qemu-iotests/198 line 96
Quoted 9 lines
tests/qemu-iotests/198 new file +8
-0+ +echo +echo === On destination, execute savevm and loadvm === +echo + +silent= +_send_qemu_cmd $dest 'savevm state1"' "(qemu)" +_send_qemu_cmd $dest 'loadvm state1"' "(qemu)"Any specific reason why the snapshot name has a trailing double quote?
No reason, just an ugly that slipped by. I'll remove it in the next version.
Thanks,
Daniel
Quoted 54 lines
Max
Quoted 50 lines
tests/qemu-iotests/198 new file +14
-0+ +echo +echo === Shut down and check image === +echo + +_send_qemu_cmd $src 'quit' "" +_send_qemu_cmd $dest 'quit' "" +wait=1 _cleanup_qemu + +_check_test_img + +# success, all done +echo "*** done" +status=0tests/qemu-iotests/198.out new file +20
-0@@ -0,0 +1,20 @@ +QA output created by 198 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 + +=== Starting VMs === + + +=== Set 'migrate_set_capability postcopy-ram on' and migrate === + + +=== On destination, execute savevm and loadvm === + +(qemu) savevm state1" +(qemu) loadvm state1" + +=== Shut down and check image === + +(qemu) quit +(qemu) quit +No errors were found on the image. +*** donetests/qemu-iotests/group +1
-0@@ -194,3 +194,4 @@ 194 rw auto migration quick 195 rw auto quick 197 rw auto quick +198 rw auto migration
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
Quoted 137 lines · Daniel Henrique Barboza
Hi Max,
Quoted 124 lines · Max Reitz
Quoted 18 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.Quoted 6 lines
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+) create mode 100755 tests/qemu-iotests/198 create mode 100644 tests/qemu-iotests/198.outLooks good overall, just two nitpicks below.
Quoted 84 lines
tests/qemu-iotests/198 new file +78
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' and migrate ===tests/qemu-iotests/198 line 88
Quoted 10 lines
tests/qemu-iotests/198 new file +10
-0+echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"Would it make sense to query the migration status non-silently here, too, so that the test output would verify that it has actually succeeded?
Quoted 2 lines
(I suppose the savevm/loadvm coming up next would fail if the migration failed, but maybe if it's easy enough...)
Not exactly non-silently, but we can do something like this:
echo
echo === Check if migration was successful ===
echo
Quoted 8 lines
QEMU_COMM_TIMEOUT=1 silent=yes \
_send_qemu_cmd$src "info migrate" "completed" silent=yes_send_qemu_cmd$src "" "(qemu)"If migration failed, the test will fail with timeout error waiting for "completed"
prior to savevm. What do you think?
Sounds good. Shouldn't you keep the qemu_cmd_repeat=10, though?
Max
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
Quoted 142 lines · Max Reitz
Quoted 141 lines · Daniel Henrique Barboza
Hi Max,
Quoted 124 lines · Max Reitz
Quoted 18 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.Quoted 6 lines
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+)create mode 100755 tests/qemu-iotests/198
create mode 100644 tests/qemu-iotests/198.outLooks good overall, just two nitpicks below.
Quoted 84 lines
tests/qemu-iotests/198 new file +78
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' and migrate ===tests/qemu-iotests/198 line 88
Quoted 10 lines
tests/qemu-iotests/198 new file +10
-0+echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"Would it make sense to query the migration status non-silently here, too, so that the test output would verify that it has actually succeeded?
Quoted 2 lines
(I suppose the savevm/loadvm coming up next would fail if the migration failed, but maybe if it's easy enough...)
Not exactly non-silently, but we can do something like this:
echo
echo === Check if migration was successful ===
echoQEMU_COMM_TIMEOUT=1 silent=yes \
_send_qemu_cmd$src "info migrate" "completed"
silent=yes_send_qemu_cmd$src "" "(qemu)"
Quoted 4 lines
Quoted 3 lines
If migration failed, the test will fail with timeout error waiting for "completed"
prior to savevm. What do you think?Sounds good. Shouldn't you keep the qemu_cmd_repeat=10, though?
I don't think it's needed. The command prior to it was:
+QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \
+ _send_qemu_cmd $src "info migrate" "completed\|failed"
+silent=yes _send_qemu_cmd $src "" "(qemu)"
So it's guaranteed that the next 'info migrate' will contain the string "completed" or "failed".
Daniel
Quoted 3 lines
Max
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
Quoted 166 lines · Daniel Henrique Barboza
Quoted 151 lines · Max Reitz
Quoted 150 lines · Daniel Henrique Barboza
Hi Max,
Quoted 133 lines · Max Reitz
Quoted 18 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.Quoted 7 lines
tests/qemu-iotests/198 | 110
+++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/198.out | 20 +++++++++
tests/qemu-iotests/group | 1 +3 files changed, 131 insertions(+)create mode 100755 tests/qemu-iotests/198
create mode 100644 tests/qemu-iotests/198.outLooks good overall, just two nitpicks below.
Quoted 95 lines
tests/qemu-iotests/198 new file +9
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/ormodify
+# it under the terms of the GNU General Public License as published bytests/qemu-iotests/198 new file +10
-0+# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see<http://www.gnu.org/licenses/>.
tests/qemu-iotests/198 new file +42
-0+# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drivefile="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk
tests/qemu-iotests/198 new file +10
-0+fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drivefile="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \
+ -incoming "unix:${MIG_SOCKET}"tests/qemu-iotests/198 new file +5
-0+fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' andmigrate ===
tests/qemu-iotests/198 new file +4
-0+echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on'"(qemu)"
tests/qemu-iotests/198 line 88
Quoted 6 lines
tests/qemu-iotests/198 new file +6
-0+_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"Would it make sense to query the migration status non-silently here, too, so that the test output would verify that it has actually succeeded?
Quoted 2 lines
(I suppose the savevm/loadvm coming up next would fail if the migration failed, but maybe if it's easy enough...)
Not exactly non-silently, but we can do something like this:
echo
echo === Check if migration was successful ===
echoQEMU_COMM_TIMEOUT=1 silent=yes \
_send_qemu_cmd$src "info migrate" "completed" silent=yes_send_qemu_cmd$src "" "(qemu)"Quoted 4 lines
Quoted 3 lines
If migration failed, the test will fail with timeout error waiting for "completed"
prior to savevm. What do you think?Sounds good. Shouldn't you keep the qemu_cmd_repeat=10, though?
I don't think it's needed. The command prior to it was:
tests/qemu-iotests/198 new file +3
-0+QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"
Quoted 2 lines
So it's guaranteed that the next 'info migrate' will contain the string "completed" or "failed".
Ah, right. I thought you'd simply replace that by the other. But either way works for me.
Max
Re: [Qemu-devel] [PATCH v3 2/2] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
Quoted 165 lines · Max Reitz
Quoted 164 lines · Daniel Henrique Barboza
Quoted 151 lines · Max Reitz
Quoted 150 lines · Daniel Henrique Barboza
Hi Max,
Quoted 133 lines · Max Reitz
Quoted 18 lines · Daniel Henrique Barboza
This patch implements a test case for the scenario that was failing prior to the patch "
migration/ram.c: do not set 'postcopy_running' inPOSTCOPY_INCOMING_END".This new test file 198 was derived from the test file 181 authored by Kevin Wolf.
CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>CC Cleber Rosa <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>---
I CCed Cleber Rosa because this patch was developed at the same time his patch series "[PATCH 00/10] I/O tests cleanups" hit the mailing list. Most of the cleanups/fixes he made in the series was done in this new test as well.Quoted 7 lines
tests/qemu-iotests/198 | 110 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 20 +++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 131 insertions(+)create mode 100755 tests/qemu-iotests/198
create mode 100644 tests/qemu-iotests/198.outLooks good overall, just two nitpicks below.
Quoted 95 lines
tests/qemu-iotests/198 new file +9
-0@@ -0,0 +1,110 @@ +#!/bin/bash +# +# Test savevm and loadvm after live migration with postcopy flag +# +# Copyright (C) 2017, IBM Corporation. +# +# This file is derived from tests/qemu-iotests/181 by Kevin Wolf +# +# This program is free software; you can redistribute it and/ormodify
+# it under the terms of the GNU General Public License as published bytests/qemu-iotests/198 new file +10
-0+# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see<http://www.gnu.org/licenses/>.
tests/qemu-iotests/198 new file +42
-0+# +# Creator/Owner : [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +MIG_SOCKET="${TEST_DIR}/migrate" + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_cleanup() +{ + rm -f "${MIG_SOCKET}" + _cleanup_test_img + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + +size=64M +_make_test_img $size + +echo +echo === Starting VMs === +echo + +qemu_comm_method="monitor" + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drivefile="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk
tests/qemu-iotests/198 new file +10
-0+fi +src=$QEMU_HANDLE + +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drivefile="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \
+ -incoming "unix:${MIG_SOCKET}"tests/qemu-iotests/198 new file +5
-0+fi +dest=$QEMU_HANDLE + +echo +echo === Set \'migrate_set_capability postcopy-ram on\' andmigrate ===
tests/qemu-iotests/198 new file +4
-0+echo + +silent=yes +_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on'"(qemu)"
tests/qemu-iotests/198 line 88
Quoted 6 lines
tests/qemu-iotests/198 new file +6
-0+_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" +_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" + +QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"Would it make sense to query the migration status non-silently here, too, so that the test output would verify that it has actually succeeded?
Quoted 2 lines
(I suppose the savevm/loadvm coming up next would fail if the migration failed, but maybe if it's easy enough...)
Not exactly non-silently, but we can do something like this:
echo
echo === Check if migration was successful ===
echoQEMU_COMM_TIMEOUT=1 silent=yes \
_send_qemu_cmd$src "info migrate" "completed"
silent=yes_send_qemu_cmd$src "" "(qemu)"Quoted 4 lines
Quoted 3 lines
If migration failed, the test will fail with timeout error waiting for "completed"
prior to savevm. What do you think?Sounds good. Shouldn't you keep the qemu_cmd_repeat=10, though?
I don't think it's needed. The command prior to it was:
tests/qemu-iotests/198 new file +3
-0+QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ + _send_qemu_cmd $src "info migrate" "completed\|failed" +silent=yes _send_qemu_cmd $src "" "(qemu)"
Quoted 4 lines
Quoted 2 lines
So it's guaranteed that the next 'info migrate' will contain the string "completed" or "failed".
Ah, right. I thought you'd simply replace that by the other. But either way works for me.
Hmmm that's a good approach too I guess. It is shorter, but has the drawback of, in case of failure, we'll repeat the command 10 times before failing.
I'll respin the patch with the first approach I had in mind. If anyone has a good case to use this second approach I can respin it again.
Daniel
Quoted 3 lines
Max