]> Git Repo - qemu.git/blame - tests/qemu-iotests/262
iotests: Add poke_file_[bl]e functions
[qemu.git] / tests / qemu-iotests / 262
CommitLineData
7c477526 1#!/usr/bin/env python3
5b96e6a0
KW
2#
3# Copyright (C) 2019 Red Hat, Inc.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17#
18# Creator/Owner: Kevin Wolf <[email protected]>
19#
20# Test migration with filter drivers present. Keep everything in an
21# iothread just for fun.
22
23import iotests
24import os
25
26iotests.verify_image_format(supported_fmts=['qcow2'])
27iotests.verify_platform(['linux'])
28
29with iotests.FilePath('img') as img_path, \
30 iotests.FilePath('mig_fifo') as fifo, \
31 iotests.VM(path_suffix='a') as vm_a, \
32 iotests.VM(path_suffix='b') as vm_b:
33
34 def add_opts(vm):
35 vm.add_object('iothread,id=iothread0')
36 vm.add_object('throttle-group,id=tg0,x-bps-total=65536')
37 vm.add_blockdev('file,filename=%s,node-name=drive0-file' % (img_path))
38 vm.add_blockdev('%s,file=drive0-file,node-name=drive0-fmt' % (iotests.imgfmt))
39 vm.add_blockdev('copy-on-read,file=drive0-fmt,node-name=drive0-cor')
40 vm.add_blockdev('throttle,file=drive0-cor,node-name=drive0-throttle,throttle-group=tg0')
41 vm.add_blockdev('blkdebug,image=drive0-throttle,node-name=drive0-dbg')
42 vm.add_blockdev('null-co,node-name=null,read-zeroes=on')
43 vm.add_blockdev('blkverify,test=drive0-dbg,raw=null,node-name=drive0-verify')
44
45 if iotests.supports_quorum():
46 vm.add_blockdev('quorum,children.0=drive0-verify,vote-threshold=1,node-name=drive0-quorum')
47 root = "drive0-quorum"
48 else:
49 root = "drive0-verify"
50
51 vm.add_device('virtio-blk,drive=%s,iothread=iothread0' % root)
52
53 iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, img_path, '64M')
54
55 os.mkfifo(fifo)
56
5b96e6a0
KW
57 iotests.log('Launching destination VM...')
58 add_opts(vm_b)
59 vm_b.add_incoming("exec: cat '%s'" % (fifo))
60 vm_b.launch()
61
62 vm_b.enable_migration_events('B')
63
4d804b53
HR
64 iotests.log('Launching source VM...')
65 add_opts(vm_a)
66 vm_a.launch()
67
68 vm_a.enable_migration_events('A')
69
5b96e6a0
KW
70 iotests.log('Starting migration to B...')
71 iotests.log(vm_a.qmp('migrate', uri='exec:cat >%s' % (fifo)))
72 with iotests.Timeout(3, 'Migration does not complete'):
73 # Wait for the source first (which includes setup=setup)
8da7969b 74 vm_a.wait_migration('postmigrate')
5b96e6a0 75 # Wait for the destination second (which does not)
8da7969b 76 vm_b.wait_migration('running')
5b96e6a0
KW
77
78 iotests.log(vm_a.qmp('query-migrate')['return']['status'])
79 iotests.log(vm_b.qmp('query-migrate')['return']['status'])
80
81 iotests.log(vm_a.qmp('query-status'))
82 iotests.log(vm_b.qmp('query-status'))
This page took 0.086241 seconds and 4 git commands to generate.