b7719bcad2
Instead of duplicating the code to wait until the server is ready and remember to terminate the server and wait for it, make it possible to use like this: with qemu_nbd_popen('-k', sock, image): # Access image via qemu-nbd socket... Only test 264 used this helper, but I had to modify the output since it did not consistently when starting and stopping qemu-nbd. Signed-off-by: Nir Soffer <nsoffer@redhat.com> Message-Id: <20200727215846.395443-3-nsoffer@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
16 lines
671 B
Plaintext
16 lines
671 B
Plaintext
Start NBD server
|
|
{"execute": "blockdev-add", "arguments": {"driver": "raw", "file": {"driver": "nbd", "reconnect-delay": 10, "server": {"path": "TEST_DIR/PID-nbd-sock", "type": "unix"}}, "node-name": "backup0"}}
|
|
{"return": {}}
|
|
{"execute": "blockdev-backup", "arguments": {"device": "drive0", "speed": 1048576, "sync": "full", "target": "backup0"}}
|
|
{"return": {}}
|
|
Backup job is started
|
|
Kill NBD server
|
|
Backup job is still in progress
|
|
{"execute": "block-job-set-speed", "arguments": {"device": "drive0", "speed": 0}}
|
|
{"return": {}}
|
|
Start NBD server
|
|
Backup completed: 5242880
|
|
{"execute": "blockdev-del", "arguments": {"node-name": "backup0"}}
|
|
{"return": {}}
|
|
Kill NBD server
|