diff mbox series

[v2,12/20] iotests: 56: prepare for backup over block-copy

Message ID 20200601181118.579-13-vsementsov@virtuozzo.com
State New
Headers show
Series backup performance: block_status + async | expand

Commit Message

Vladimir Sementsov-Ogievskiy June 1, 2020, 6:11 p.m. UTC
After introducing parallel async copy requests instead of plain
cluster-by-cluster copying loop, we'll have to wait for paused status,
as we need to wait for several parallel request. So, let's gently wait
instead of just asserting that job already paused.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/056 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Max Reitz July 23, 2020, 7:57 a.m. UTC | #1
On 01.06.20 20:11, Vladimir Sementsov-Ogievskiy wrote:
> After introducing parallel async copy requests instead of plain
> cluster-by-cluster copying loop, we'll have to wait for paused status,
> as we need to wait for several parallel request. So, let's gently wait
> instead of just asserting that job already paused.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  tests/qemu-iotests/056 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056
> index f73fc74457..2ced356a43 100755
> --- a/tests/qemu-iotests/056
> +++ b/tests/qemu-iotests/056
> @@ -306,8 +306,12 @@ class BackupTest(iotests.QMPTestCase):
>          event = self.vm.event_wait(name="BLOCK_JOB_ERROR",
>                                     match={'data': {'device': 'drive0'}})
>          self.assertNotEqual(event, None)
> -        # OK, job should be wedged
> -        res = self.vm.qmp('query-block-jobs')
> +        # OK, job should pause, but it can't do it immediately, as it can't
> +        # cancel other parallel requests (which didn't fail)
> +        while True:
> +            res = self.vm.qmp('query-block-jobs')
> +            if res['return'][0]['status'] == 'paused':
> +                break

A timeout around this would be nice, I think.

>          self.assert_qmp(res, 'return[0]/status', 'paused')
>          res = self.vm.qmp('block-job-dismiss', id='drive0')
>          self.assert_qmp(res, 'error/desc',
>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056
index f73fc74457..2ced356a43 100755
--- a/tests/qemu-iotests/056
+++ b/tests/qemu-iotests/056
@@ -306,8 +306,12 @@  class BackupTest(iotests.QMPTestCase):
         event = self.vm.event_wait(name="BLOCK_JOB_ERROR",
                                    match={'data': {'device': 'drive0'}})
         self.assertNotEqual(event, None)
-        # OK, job should be wedged
-        res = self.vm.qmp('query-block-jobs')
+        # OK, job should pause, but it can't do it immediately, as it can't
+        # cancel other parallel requests (which didn't fail)
+        while True:
+            res = self.vm.qmp('query-block-jobs')
+            if res['return'][0]['status'] == 'paused':
+                break
         self.assert_qmp(res, 'return[0]/status', 'paused')
         res = self.vm.qmp('block-job-dismiss', id='drive0')
         self.assert_qmp(res, 'error/desc',