1 | The following changes since commit 2b483739791b33c46e6084b51edcf62107058ae1: | 1 | The following changes since commit 240ab11fb72049d6373cbbec8d788f8e411a00bc: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170904-2' into staging (2017-09-04 17:21:24 +0100) | 3 | Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190924' into staging (2019-09-24 15:36:31 +0100) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://github.com/stefanha/qemu.git tags/block-pull-request | 7 | https://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to b461151ff31c7925f271c297e8abed20231ac7d3: | 9 | for you to fetch changes up to f9a7e3698a737ee75a7b0af34203303df982550f: |
10 | 10 | ||
11 | block: document semantics of bdrv_co_preadv|pwritev (2017-09-05 11:07:02 +0100) | 11 | virtio-blk: schedule virtio_notify_config to run on main context (2019-09-25 18:06:36 +0100) |
12 | |||
13 | ---------------------------------------------------------------- | ||
14 | Pull request | ||
12 | 15 | ||
13 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
14 | 17 | ||
15 | ---------------------------------------------------------------- | 18 | Sergio Lopez (1): |
19 | virtio-blk: schedule virtio_notify_config to run on main context | ||
16 | 20 | ||
17 | Daniel P. Berrange (1): | 21 | Vladimir Sementsov-Ogievskiy (1): |
18 | block: document semantics of bdrv_co_preadv|pwritev | 22 | util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended |
19 | 23 | ||
20 | Stefan Hajnoczi (3): | 24 | hw/block/virtio-blk.c | 16 +++++++++++++++- |
21 | qemu.py: make VM() a context manager | 25 | util/iov.c | 3 ++- |
22 | iotests.py: add FilePath context manager | 26 | 2 files changed, 17 insertions(+), 2 deletions(-) |
23 | qemu-iotests: use context managers for resource cleanup in 194 | ||
24 | |||
25 | include/block/block_int.h | 31 +++++++++++ | ||
26 | scripts/qemu.py | 16 +++++- | ||
27 | tests/qemu-iotests/194 | 117 +++++++++++++++++++++--------------------- | ||
28 | tests/qemu-iotests/iotests.py | 26 ++++++++++ | ||
29 | 4 files changed, 130 insertions(+), 60 deletions(-) | ||
30 | 27 | ||
31 | -- | 28 | -- |
32 | 2.13.5 | 29 | 2.21.0 |
33 | 30 | ||
34 | 31 | diff view generated by jsdifflib |
1 | From: "Daniel P. Berrange" <berrange@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 3 | Make it more obvious, that filling qiov corresponds to qiov allocation, |
4 | Reviewed-by: Eric Blake <eblake@redhat.com> | 4 | which in turn corresponds to total_niov calculation, based on mid_niov |
5 | Signed-off-by: Daniel P. Berrange <berrange@redhat.com> | 5 | (not mid_len). Still add an assertion to show that there should be no |
6 | Message-id: 20170831105456.9558-1-berrange@redhat.com | 6 | difference. |
7 | |||
8 | Reported-by: Coverity (CID 1405302) | ||
9 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
10 | Message-id: 20190910090310.14032-1-vsementsov@virtuozzo.com | ||
11 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
13 | Message-Id: <20190910090310.14032-1-vsementsov@virtuozzo.com> | ||
7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
8 | --- | 15 | --- |
9 | include/block/block_int.h | 31 +++++++++++++++++++++++++++++++ | 16 | util/iov.c | 3 ++- |
10 | 1 file changed, 31 insertions(+) | 17 | 1 file changed, 2 insertions(+), 1 deletion(-) |
11 | 18 | ||
12 | diff --git a/include/block/block_int.h b/include/block/block_int.h | 19 | diff --git a/util/iov.c b/util/iov.c |
13 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/include/block/block_int.h | 21 | --- a/util/iov.c |
15 | +++ b/include/block/block_int.h | 22 | +++ b/util/iov.c |
16 | @@ -XXX,XX +XXX,XX @@ struct BlockDriver { | 23 | @@ -XXX,XX +XXX,XX @@ void qemu_iovec_init_extended( |
17 | 24 | p++; | |
18 | int coroutine_fn (*bdrv_co_readv)(BlockDriverState *bs, | 25 | } |
19 | int64_t sector_num, int nb_sectors, QEMUIOVector *qiov); | 26 | |
20 | + | 27 | - if (mid_len) { |
21 | + /** | 28 | + assert(!mid_niov == !mid_len); |
22 | + * @offset: position in bytes to read at | 29 | + if (mid_niov) { |
23 | + * @bytes: number of bytes to read | 30 | memcpy(p, mid_iov, mid_niov * sizeof(*p)); |
24 | + * @qiov: the buffers to fill with read data | 31 | p[0].iov_base = (uint8_t *)p[0].iov_base + mid_head; |
25 | + * @flags: currently unused, always 0 | 32 | p[0].iov_len -= mid_head; |
26 | + * | ||
27 | + * @offset and @bytes will be a multiple of 'request_alignment', | ||
28 | + * but the length of individual @qiov elements does not have to | ||
29 | + * be a multiple. | ||
30 | + * | ||
31 | + * @bytes will always equal the total size of @qiov, and will be | ||
32 | + * no larger than 'max_transfer'. | ||
33 | + * | ||
34 | + * The buffer in @qiov may point directly to guest memory. | ||
35 | + */ | ||
36 | int coroutine_fn (*bdrv_co_preadv)(BlockDriverState *bs, | ||
37 | uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags); | ||
38 | int coroutine_fn (*bdrv_co_writev)(BlockDriverState *bs, | ||
39 | int64_t sector_num, int nb_sectors, QEMUIOVector *qiov); | ||
40 | int coroutine_fn (*bdrv_co_writev_flags)(BlockDriverState *bs, | ||
41 | int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, int flags); | ||
42 | + /** | ||
43 | + * @offset: position in bytes to write at | ||
44 | + * @bytes: number of bytes to write | ||
45 | + * @qiov: the buffers containing data to write | ||
46 | + * @flags: zero or more bits allowed by 'supported_write_flags' | ||
47 | + * | ||
48 | + * @offset and @bytes will be a multiple of 'request_alignment', | ||
49 | + * but the length of individual @qiov elements does not have to | ||
50 | + * be a multiple. | ||
51 | + * | ||
52 | + * @bytes will always equal the total size of @qiov, and will be | ||
53 | + * no larger than 'max_transfer'. | ||
54 | + * | ||
55 | + * The buffer in @qiov may point directly to guest memory. | ||
56 | + */ | ||
57 | int coroutine_fn (*bdrv_co_pwritev)(BlockDriverState *bs, | ||
58 | uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags); | ||
59 | |||
60 | -- | 33 | -- |
61 | 2.13.5 | 34 | 2.21.0 |
62 | 35 | ||
63 | 36 | diff view generated by jsdifflib |
1 | There are a number of ways to ensure that the QEMU process is shut down | 1 | From: Sergio Lopez <slp@redhat.com> |
---|---|---|---|
2 | when the test ends, including atexit.register(), try: finally:, or | ||
3 | unittest.teardown() methods. All of these require extra code and the | ||
4 | programmer must remember to add vm.shutdown(). | ||
5 | 2 | ||
6 | A nice solution is context managers: | 3 | virtio_notify_config() needs to acquire the global mutex, which isn't |
4 | allowed from an iothread, and may lead to a deadlock like this: | ||
7 | 5 | ||
8 | with VM(binary) as vm: | 6 | - main thead |
9 | ... | 7 | * Has acquired: qemu_global_mutex. |
10 | # vm is guaranteed to be shut down here | 8 | * Is trying the acquire: iothread AioContext lock via |
9 | AIO_WAIT_WHILE (after aio_poll). | ||
11 | 10 | ||
12 | Cc: Eduardo Habkost <ehabkost@redhat.com> | 11 | - iothread |
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 12 | * Has acquired: AioContext lock. |
14 | Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> | 13 | * Is trying to acquire: qemu_global_mutex (via |
15 | Message-id: 20170824072202.26818-2-stefanha@redhat.com | 14 | virtio_notify_config->prepare_mmio_access). |
15 | |||
16 | If virtio_blk_resize() is called from an iothread, schedule | ||
17 | virtio_notify_config() to be run in the main context BH. | ||
18 | |||
19 | [Removed unnecessary newline as suggested by Kevin Wolf | ||
20 | <kwolf@redhat.com>. | ||
21 | --Stefan] | ||
22 | |||
23 | Signed-off-by: Sergio Lopez <slp@redhat.com> | ||
24 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
25 | Message-id: 20190916112411.21636-1-slp@redhat.com | ||
26 | Message-Id: <20190916112411.21636-1-slp@redhat.com> | ||
16 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 27 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
17 | --- | 28 | --- |
18 | scripts/qemu.py | 16 +++++++++++++++- | 29 | hw/block/virtio-blk.c | 16 +++++++++++++++- |
19 | 1 file changed, 15 insertions(+), 1 deletion(-) | 30 | 1 file changed, 15 insertions(+), 1 deletion(-) |
20 | 31 | ||
21 | diff --git a/scripts/qemu.py b/scripts/qemu.py | 32 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c |
22 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/scripts/qemu.py | 34 | --- a/hw/block/virtio-blk.c |
24 | +++ b/scripts/qemu.py | 35 | +++ b/hw/block/virtio-blk.c |
25 | @@ -XXX,XX +XXX,XX @@ import qmp.qmp | 36 | @@ -XXX,XX +XXX,XX @@ |
26 | 37 | #include "qemu/iov.h" | |
27 | 38 | #include "qemu/module.h" | |
28 | class QEMUMachine(object): | 39 | #include "qemu/error-report.h" |
29 | - '''A QEMU VM''' | 40 | +#include "qemu/main-loop.h" |
30 | + '''A QEMU VM | 41 | #include "trace.h" |
42 | #include "hw/block/block.h" | ||
43 | #include "hw/qdev-properties.h" | ||
44 | @@ -XXX,XX +XXX,XX @@ static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f, | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | +static void virtio_resize_cb(void *opaque) | ||
49 | +{ | ||
50 | + VirtIODevice *vdev = opaque; | ||
31 | + | 51 | + |
32 | + Use this object as a context manager to ensure the QEMU process terminates:: | 52 | + assert(qemu_get_current_aio_context() == qemu_get_aio_context()); |
53 | + virtio_notify_config(vdev); | ||
54 | +} | ||
33 | + | 55 | + |
34 | + with VM(binary) as vm: | 56 | static void virtio_blk_resize(void *opaque) |
35 | + ... | 57 | { |
36 | + # vm is guaranteed to be shut down here | 58 | VirtIODevice *vdev = VIRTIO_DEVICE(opaque); |
37 | + ''' | 59 | |
38 | 60 | - virtio_notify_config(vdev); | |
39 | def __init__(self, binary, args=[], wrapper=[], name=None, test_dir="/var/tmp", | 61 | + /* |
40 | monitor_address=None, socket_scm_helper=None, debug=False): | 62 | + * virtio_notify_config() needs to acquire the global mutex, |
41 | @@ -XXX,XX +XXX,XX @@ class QEMUMachine(object): | 63 | + * so it can't be called from an iothread. Instead, schedule |
42 | self._socket_scm_helper = socket_scm_helper | 64 | + * it to be run in the main context BH. |
43 | self._debug = debug | 65 | + */ |
44 | 66 | + aio_bh_schedule_oneshot(qemu_get_aio_context(), virtio_resize_cb, vdev); | |
45 | + def __enter__(self): | 67 | } |
46 | + return self | 68 | |
47 | + | 69 | static const BlockDevOps virtio_block_ops = { |
48 | + def __exit__(self, exc_type, exc_val, exc_tb): | ||
49 | + self.shutdown() | ||
50 | + return False | ||
51 | + | ||
52 | # This can be used to add an unused monitor instance. | ||
53 | def add_monitor_telnet(self, ip, port): | ||
54 | args = 'tcp:%s:%d,server,nowait,telnet' % (ip, port) | ||
55 | -- | 70 | -- |
56 | 2.13.5 | 71 | 2.21.0 |
57 | 72 | ||
58 | 73 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The scratch/ (TEST_DIR) directory is not automatically cleaned up after | ||
2 | test execution. It is the responsibility of tests to remove any files | ||
3 | they create. | ||
4 | 1 | ||
5 | A nice way of doing this is to declare files at the beginning of the | ||
6 | test and automatically remove them with a context manager: | ||
7 | |||
8 | with iotests.FilePath('test.img') as img_path: | ||
9 | qemu_img(...) | ||
10 | qemu_io(...) | ||
11 | # img_path is guaranteed to be deleted here | ||
12 | |||
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
14 | Message-id: 20170824072202.26818-3-stefanha@redhat.com | ||
15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
16 | --- | ||
17 | tests/qemu-iotests/iotests.py | 26 ++++++++++++++++++++++++++ | ||
18 | 1 file changed, 26 insertions(+) | ||
19 | |||
20 | diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/tests/qemu-iotests/iotests.py | ||
23 | +++ b/tests/qemu-iotests/iotests.py | ||
24 | @@ -XXX,XX +XXX,XX @@ class Timeout: | ||
25 | def timeout(self, signum, frame): | ||
26 | raise Exception(self.errmsg) | ||
27 | |||
28 | + | ||
29 | +class FilePath(object): | ||
30 | + '''An auto-generated filename that cleans itself up. | ||
31 | + | ||
32 | + Use this context manager to generate filenames and ensure that the file | ||
33 | + gets deleted:: | ||
34 | + | ||
35 | + with TestFilePath('test.img') as img_path: | ||
36 | + qemu_img('create', img_path, '1G') | ||
37 | + # migration_sock_path is automatically deleted | ||
38 | + ''' | ||
39 | + def __init__(self, name): | ||
40 | + filename = '{0}-{1}'.format(os.getpid(), name) | ||
41 | + self.path = os.path.join(test_dir, filename) | ||
42 | + | ||
43 | + def __enter__(self): | ||
44 | + return self.path | ||
45 | + | ||
46 | + def __exit__(self, exc_type, exc_val, exc_tb): | ||
47 | + try: | ||
48 | + os.remove(self.path) | ||
49 | + except OSError: | ||
50 | + pass | ||
51 | + return False | ||
52 | + | ||
53 | + | ||
54 | class VM(qtest.QEMUQtestMachine): | ||
55 | '''A QEMU VM''' | ||
56 | |||
57 | -- | ||
58 | 2.13.5 | ||
59 | |||
60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Switch from atexit.register() to a more elegant idiom of declaring | ||
2 | resources in a with statement: | ||
3 | 1 | ||
4 | with FilePath('monitor.sock') as monitor_path, | ||
5 | VM() as vm: | ||
6 | ... | ||
7 | |||
8 | The files and VMs will be automatically cleaned up whether the test | ||
9 | passes or fails. | ||
10 | |||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
12 | Message-id: 20170824072202.26818-4-stefanha@redhat.com | ||
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
14 | --- | ||
15 | tests/qemu-iotests/194 | 117 ++++++++++++++++++++++++------------------------- | ||
16 | 1 file changed, 58 insertions(+), 59 deletions(-) | ||
17 | |||
18 | diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194 | ||
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/tests/qemu-iotests/194 | ||
21 | +++ b/tests/qemu-iotests/194 | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | # | ||
24 | # Non-shared storage migration test using NBD server and drive-mirror | ||
25 | |||
26 | -import os | ||
27 | -import atexit | ||
28 | import iotests | ||
29 | |||
30 | iotests.verify_platform(['linux']) | ||
31 | |||
32 | -img_size = '1G' | ||
33 | -source_img_path = os.path.join(iotests.test_dir, 'source.img') | ||
34 | -dest_img_path = os.path.join(iotests.test_dir, 'dest.img') | ||
35 | -iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, source_img_path, img_size) | ||
36 | -iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, dest_img_path, img_size) | ||
37 | - | ||
38 | -iotests.log('Launching VMs...') | ||
39 | -migration_sock_path = os.path.join(iotests.test_dir, 'migration.sock') | ||
40 | -nbd_sock_path = os.path.join(iotests.test_dir, 'nbd.sock') | ||
41 | -source_vm = iotests.VM('source').add_drive(source_img_path) | ||
42 | -dest_vm = (iotests.VM('dest').add_drive(dest_img_path) | ||
43 | - .add_incoming('unix:{0}'.format(migration_sock_path))) | ||
44 | -source_vm.launch() | ||
45 | -atexit.register(source_vm.shutdown) | ||
46 | -dest_vm.launch() | ||
47 | -atexit.register(dest_vm.shutdown) | ||
48 | - | ||
49 | -iotests.log('Launching NBD server on destination...') | ||
50 | -iotests.log(dest_vm.qmp('nbd-server-start', addr={'type': 'unix', 'data': {'path': nbd_sock_path}})) | ||
51 | -iotests.log(dest_vm.qmp('nbd-server-add', device='drive0', writable=True)) | ||
52 | - | ||
53 | -iotests.log('Starting `drive-mirror` on source...') | ||
54 | -iotests.log(source_vm.qmp( | ||
55 | - 'drive-mirror', | ||
56 | - device='drive0', | ||
57 | - target='nbd+unix:///drive0?socket={0}'.format(nbd_sock_path), | ||
58 | - sync='full', | ||
59 | - format='raw', # always raw, the server handles the format | ||
60 | - mode='existing', | ||
61 | - job_id='mirror-job0')) | ||
62 | - | ||
63 | -iotests.log('Waiting for `drive-mirror` to complete...') | ||
64 | -iotests.log(source_vm.event_wait('BLOCK_JOB_READY'), | ||
65 | - filters=[iotests.filter_qmp_event]) | ||
66 | - | ||
67 | -iotests.log('Starting migration...') | ||
68 | -source_vm.qmp('migrate-set-capabilities', | ||
69 | - capabilities=[{'capability': 'events', 'state': True}]) | ||
70 | -dest_vm.qmp('migrate-set-capabilities', | ||
71 | - capabilities=[{'capability': 'events', 'state': True}]) | ||
72 | -iotests.log(source_vm.qmp('migrate', uri='unix:{0}'.format(migration_sock_path))) | ||
73 | - | ||
74 | -while True: | ||
75 | - event1 = source_vm.event_wait('MIGRATION') | ||
76 | - iotests.log(event1, filters=[iotests.filter_qmp_event]) | ||
77 | - if event1['data']['status'] in ('completed', 'failed'): | ||
78 | - iotests.log('Gracefully ending the `drive-mirror` job on source...') | ||
79 | - iotests.log(source_vm.qmp('block-job-cancel', device='mirror-job0')) | ||
80 | - break | ||
81 | - | ||
82 | -while True: | ||
83 | - event2 = source_vm.event_wait('BLOCK_JOB_COMPLETED') | ||
84 | - iotests.log(event2, filters=[iotests.filter_qmp_event]) | ||
85 | - if event2['event'] == 'BLOCK_JOB_COMPLETED': | ||
86 | - iotests.log('Stopping the NBD server on destination...') | ||
87 | - iotests.log(dest_vm.qmp('nbd-server-stop')) | ||
88 | - break | ||
89 | +with iotests.FilePath('source.img') as source_img_path, \ | ||
90 | + iotests.FilePath('dest.img') as dest_img_path, \ | ||
91 | + iotests.FilePath('migration.sock') as migration_sock_path, \ | ||
92 | + iotests.FilePath('nbd.sock') as nbd_sock_path, \ | ||
93 | + iotests.VM('source') as source_vm, \ | ||
94 | + iotests.VM('dest') as dest_vm: | ||
95 | + | ||
96 | + img_size = '1G' | ||
97 | + iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, source_img_path, img_size) | ||
98 | + iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, dest_img_path, img_size) | ||
99 | + | ||
100 | + iotests.log('Launching VMs...') | ||
101 | + (source_vm.add_drive(source_img_path) | ||
102 | + .launch()) | ||
103 | + (dest_vm.add_drive(dest_img_path) | ||
104 | + .add_incoming('unix:{0}'.format(migration_sock_path)) | ||
105 | + .launch()) | ||
106 | + | ||
107 | + iotests.log('Launching NBD server on destination...') | ||
108 | + iotests.log(dest_vm.qmp('nbd-server-start', addr={'type': 'unix', 'data': {'path': nbd_sock_path}})) | ||
109 | + iotests.log(dest_vm.qmp('nbd-server-add', device='drive0', writable=True)) | ||
110 | + | ||
111 | + iotests.log('Starting `drive-mirror` on source...') | ||
112 | + iotests.log(source_vm.qmp( | ||
113 | + 'drive-mirror', | ||
114 | + device='drive0', | ||
115 | + target='nbd+unix:///drive0?socket={0}'.format(nbd_sock_path), | ||
116 | + sync='full', | ||
117 | + format='raw', # always raw, the server handles the format | ||
118 | + mode='existing', | ||
119 | + job_id='mirror-job0')) | ||
120 | + | ||
121 | + iotests.log('Waiting for `drive-mirror` to complete...') | ||
122 | + iotests.log(source_vm.event_wait('BLOCK_JOB_READY'), | ||
123 | + filters=[iotests.filter_qmp_event]) | ||
124 | + | ||
125 | + iotests.log('Starting migration...') | ||
126 | + source_vm.qmp('migrate-set-capabilities', | ||
127 | + capabilities=[{'capability': 'events', 'state': True}]) | ||
128 | + dest_vm.qmp('migrate-set-capabilities', | ||
129 | + capabilities=[{'capability': 'events', 'state': True}]) | ||
130 | + iotests.log(source_vm.qmp('migrate', uri='unix:{0}'.format(migration_sock_path))) | ||
131 | + | ||
132 | + while True: | ||
133 | + event1 = source_vm.event_wait('MIGRATION') | ||
134 | + iotests.log(event1, filters=[iotests.filter_qmp_event]) | ||
135 | + if event1['data']['status'] in ('completed', 'failed'): | ||
136 | + iotests.log('Gracefully ending the `drive-mirror` job on source...') | ||
137 | + iotests.log(source_vm.qmp('block-job-cancel', device='mirror-job0')) | ||
138 | + break | ||
139 | + | ||
140 | + while True: | ||
141 | + event2 = source_vm.event_wait('BLOCK_JOB_COMPLETED') | ||
142 | + iotests.log(event2, filters=[iotests.filter_qmp_event]) | ||
143 | + if event2['event'] == 'BLOCK_JOB_COMPLETED': | ||
144 | + iotests.log('Stopping the NBD server on destination...') | ||
145 | + iotests.log(dest_vm.qmp('nbd-server-stop')) | ||
146 | + break | ||
147 | -- | ||
148 | 2.13.5 | ||
149 | |||
150 | diff view generated by jsdifflib |