diff mbox series

[v2,21/22] qemu-iotests/199: add early shutdown case to bitmaps postcopy

Message ID 20200217150246.29180-22-vsementsov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series Fix error handling during bitmap postcopy | expand

Commit Message

Vladimir Sementsov-Ogievskiy Feb. 17, 2020, 3:02 p.m. UTC
Previous patches fixed two crashes which may occur on shutdown prior to
bitmaps postcopy finished. Check that it works now.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/199     | 18 ++++++++++++++++++
 tests/qemu-iotests/199.out |  4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Andrey Shinkevich Feb. 19, 2020, 4:48 p.m. UTC | #1
On 17/02/2020 18:02, Vladimir Sementsov-Ogievskiy wrote:
> Previous patches fixed two crashes which may occur on shutdown prior to
> bitmaps postcopy finished. Check that it works now.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   tests/qemu-iotests/199     | 18 ++++++++++++++++++
>   tests/qemu-iotests/199.out |  4 ++--
>   2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199
> index 8baa078151..0d12e6b1ae 100755
> --- a/tests/qemu-iotests/199
> +++ b/tests/qemu-iotests/199
> @@ -217,6 +217,24 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
>               sha = self.discards1_sha256 if i % 2 else self.all_discards_sha256
>               self.assert_qmp(result, 'return/sha256', sha)
>   
> +    def test_early_shutdown_destination(self):
> +        self.start_postcopy()
> +
> +        self.vm_b_events += self.vm_b.get_qmp_events()
> +        self.vm_b.shutdown()
> +        # recreate vm_b, so there is no incoming option, which prevents
> +        # loading bitmaps from disk
> +        self.vm_b = iotests.VM(path_suffix='b').add_drive(disk_b)
> +        self.vm_b.launch()
> +        check_bitmaps(self.vm_b, 0)
> +
> +        result = self.vm_a.qmp('query-status')
> +        assert not result['return']['running']
> +        self.vm_a_events += self.vm_a.get_qmp_events()
> +        self.vm_a.shutdown()
> +        self.vm_a.launch()
> +        check_bitmaps(self.vm_a, 0)
> +
>   
>   if __name__ == '__main__':
>       iotests.main(supported_fmts=['qcow2'])
> diff --git a/tests/qemu-iotests/199.out b/tests/qemu-iotests/199.out
> index ae1213e6f8..fbc63e62f8 100644
> --- a/tests/qemu-iotests/199.out
> +++ b/tests/qemu-iotests/199.out
> @@ -1,5 +1,5 @@
> -.
> +..
>   ----------------------------------------------------------------------
> -Ran 1 tests
> +Ran 2 tests
>   
>   OK
> 

The updated test passed.

Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Andrey Shinkevich Feb. 19, 2020, 4:50 p.m. UTC | #2
On 17/02/2020 18:02, Vladimir Sementsov-Ogievskiy wrote:
> Previous patches fixed two crashes which may occur on shutdown prior to
> bitmaps postcopy finished. Check that it works now.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   tests/qemu-iotests/199     | 18 ++++++++++++++++++
>   tests/qemu-iotests/199.out |  4 ++--
>   2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199
> index 8baa078151..0d12e6b1ae 100755
> --- a/tests/qemu-iotests/199
> +++ b/tests/qemu-iotests/199
> @@ -217,6 +217,24 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
>               sha = self.discards1_sha256 if i % 2 else self.all_discards_sha256
>               self.assert_qmp(result, 'return/sha256', sha)
>   
> +    def test_early_shutdown_destination(self):
> +        self.start_postcopy()
> +
> +        self.vm_b_events += self.vm_b.get_qmp_events()
> +        self.vm_b.shutdown()
> +        # recreate vm_b, so there is no incoming option, which prevents
> +        # loading bitmaps from disk
> +        self.vm_b = iotests.VM(path_suffix='b').add_drive(disk_b)
> +        self.vm_b.launch()
> +        check_bitmaps(self.vm_b, 0)
> +

Comments would help to understand the idea behind

> +        result = self.vm_a.qmp('query-status')
> +        assert not result['return']['running']
> +        self.vm_a_events += self.vm_a.get_qmp_events()
> +        self.vm_a.shutdown()
> +        self.vm_a.launch()
> +        check_bitmaps(self.vm_a, 0)
> +
>   
>   if __name__ == '__main__':
>       iotests.main(supported_fmts=['qcow2'])
> diff --git a/tests/qemu-iotests/199.out b/tests/qemu-iotests/199.out
> index ae1213e6f8..fbc63e62f8 100644
> --- a/tests/qemu-iotests/199.out
> +++ b/tests/qemu-iotests/199.out
> @@ -1,5 +1,5 @@
> -.
> +..
>   ----------------------------------------------------------------------
> -Ran 1 tests
> +Ran 2 tests
>   
>   OK
>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199
index 8baa078151..0d12e6b1ae 100755
--- a/tests/qemu-iotests/199
+++ b/tests/qemu-iotests/199
@@ -217,6 +217,24 @@  class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
             sha = self.discards1_sha256 if i % 2 else self.all_discards_sha256
             self.assert_qmp(result, 'return/sha256', sha)
 
+    def test_early_shutdown_destination(self):
+        self.start_postcopy()
+
+        self.vm_b_events += self.vm_b.get_qmp_events()
+        self.vm_b.shutdown()
+        # recreate vm_b, so there is no incoming option, which prevents
+        # loading bitmaps from disk
+        self.vm_b = iotests.VM(path_suffix='b').add_drive(disk_b)
+        self.vm_b.launch()
+        check_bitmaps(self.vm_b, 0)
+
+        result = self.vm_a.qmp('query-status')
+        assert not result['return']['running']
+        self.vm_a_events += self.vm_a.get_qmp_events()
+        self.vm_a.shutdown()
+        self.vm_a.launch()
+        check_bitmaps(self.vm_a, 0)
+
 
 if __name__ == '__main__':
     iotests.main(supported_fmts=['qcow2'])
diff --git a/tests/qemu-iotests/199.out b/tests/qemu-iotests/199.out
index ae1213e6f8..fbc63e62f8 100644
--- a/tests/qemu-iotests/199.out
+++ b/tests/qemu-iotests/199.out
@@ -1,5 +1,5 @@ 
-.
+..
 ----------------------------------------------------------------------
-Ran 1 tests
+Ran 2 tests
 
 OK