mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
9dd003a998
We are going to drop group file. Define group in tests as a preparatory step. The patch is generated by cd tests/qemu-iotests grep '^[0-9]\{3\} ' group | while read line; do file=$(awk '{print $1}' <<< "$line"); groups=$(sed -e 's/^... //' <<< "$line"); awk "NR==2{print \"# group: $groups\"}1" $file > tmp; cat tmp > $file; done Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210116134424.82867-7-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
69 lines
2.2 KiB
Python
Executable File
69 lines
2.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# group: rw quick migration
|
|
#
|
|
# Test clearing unknown autoclear_features flag by qcow2 after
|
|
# migration. This test mimics migration to older qemu.
|
|
#
|
|
# Copyright (c) 2017 Parallels International GmbH
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
import os
|
|
import iotests
|
|
from iotests import qemu_img
|
|
|
|
disk = os.path.join(iotests.test_dir, 'disk')
|
|
migfile = os.path.join(iotests.test_dir, 'migfile')
|
|
|
|
class TestInvalidateAutoclear(iotests.QMPTestCase):
|
|
|
|
def tearDown(self):
|
|
self.vm_a.shutdown()
|
|
self.vm_b.shutdown()
|
|
os.remove(disk)
|
|
os.remove(migfile)
|
|
|
|
def setUp(self):
|
|
qemu_img('create', '-f', iotests.imgfmt, disk, '1M')
|
|
|
|
self.vm_a = iotests.VM(path_suffix='a').add_drive(disk)
|
|
self.vm_a.launch()
|
|
|
|
self.vm_b = iotests.VM(path_suffix='b').add_drive(disk)
|
|
self.vm_b.add_incoming("exec: cat '" + migfile + "'")
|
|
|
|
def test_migration(self):
|
|
result = self.vm_a.qmp('migrate', uri='exec:cat>' + migfile)
|
|
self.assert_qmp(result, 'return', {});
|
|
self.assertNotEqual(self.vm_a.event_wait("STOP"), None)
|
|
|
|
with open(disk, 'r+b') as f:
|
|
f.seek(88) # first byte of autoclear_features field
|
|
f.write(b'\xff')
|
|
|
|
self.vm_b.launch()
|
|
while True:
|
|
result = self.vm_b.qmp('query-status')
|
|
if result['return']['status'] == 'running':
|
|
break
|
|
|
|
with open(disk, 'rb') as f:
|
|
f.seek(88)
|
|
self.assertEqual(f.read(1), b'\x00')
|
|
|
|
if __name__ == '__main__':
|
|
iotests.main(supported_fmts=['qcow2'],
|
|
supported_protocols=['file'])
|