|
|
7711c0 |
From b12adbb5e07d5c146f500e920a3dc1278dfebe53 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 6 Feb 2019 22:12:43 +0100
|
|
|
7711c0 |
Subject: [PATCH 33/33] iotests: 169: add cases for source vm resuming
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190206221243.7407-24-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 84277
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v2 23/23] iotests: 169: add cases for source vm resuming
|
|
|
7711c0 |
Bugzilla: 1658343
|
|
|
7711c0 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
Test that we can resume source vm after [failed] migration, and bitmaps
|
|
|
7711c0 |
are ok.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 3e6d88f280a53b5b399e73b1f80efe4c3db306f1)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
tests/qemu-iotests/169 | 60 +++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
7711c0 |
tests/qemu-iotests/169.out | 4 ++--
|
|
|
7711c0 |
2 files changed, 61 insertions(+), 3 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/169 b/tests/qemu-iotests/169
|
|
|
7711c0 |
index 8b7947d..69850c4 100755
|
|
|
7711c0 |
--- a/tests/qemu-iotests/169
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/169
|
|
|
7711c0 |
@@ -77,6 +77,58 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase):
|
|
|
7711c0 |
self.assert_qmp(result, 'error/desc',
|
|
|
7711c0 |
"Dirty bitmap 'bitmap0' not found");
|
|
|
7711c0 |
|
|
|
7711c0 |
+ def do_test_migration_resume_source(self, persistent, migrate_bitmaps):
|
|
|
7711c0 |
+ granularity = 512
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # regions = ((start, count), ...)
|
|
|
7711c0 |
+ regions = ((0, 0x10000),
|
|
|
7711c0 |
+ (0xf0000, 0x10000),
|
|
|
7711c0 |
+ (0xa0201, 0x1000))
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ mig_caps = [{'capability': 'events', 'state': True}]
|
|
|
7711c0 |
+ if migrate_bitmaps:
|
|
|
7711c0 |
+ mig_caps.append({'capability': 'dirty-bitmaps', 'state': True})
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ result = self.vm_a.qmp('migrate-set-capabilities',
|
|
|
7711c0 |
+ capabilities=mig_caps)
|
|
|
7711c0 |
+ self.assert_qmp(result, 'return', {})
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ self.add_bitmap(self.vm_a, granularity, persistent)
|
|
|
7711c0 |
+ for r in regions:
|
|
|
7711c0 |
+ self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % r)
|
|
|
7711c0 |
+ sha256 = self.get_bitmap_hash(self.vm_a)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ result = self.vm_a.qmp('migrate', uri=mig_cmd)
|
|
|
7711c0 |
+ while True:
|
|
|
7711c0 |
+ event = self.vm_a.event_wait('MIGRATION')
|
|
|
7711c0 |
+ if event['data']['status'] == 'completed':
|
|
|
7711c0 |
+ break
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # test that bitmap is still here
|
|
|
7711c0 |
+ removed = (not migrate_bitmaps) and persistent
|
|
|
7711c0 |
+ self.check_bitmap(self.vm_a, False if removed else sha256)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ self.vm_a.qmp('cont')
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # test that bitmap is still here after invalidation
|
|
|
7711c0 |
+ self.check_bitmap(self.vm_a, sha256)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # shutdown and check that invalidation didn't fail
|
|
|
7711c0 |
+ self.vm_a.shutdown()
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # catch 'Could not reopen qcow2 layer: Bitmap already exists'
|
|
|
7711c0 |
+ # possible error
|
|
|
7711c0 |
+ log = self.vm_a.get_log()
|
|
|
7711c0 |
+ log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
|
|
|
7711c0 |
+ log = re.sub(r'^(wrote .* bytes at offset .*\n.*KiB.*ops.*sec.*\n){3}',
|
|
|
7711c0 |
+ '', log)
|
|
|
7711c0 |
+ log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
|
|
|
7711c0 |
+ self.assertEqual(log, '')
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # test that bitmap is still persistent
|
|
|
7711c0 |
+ self.vm_a.launch()
|
|
|
7711c0 |
+ self.check_bitmap(self.vm_a, sha256 if persistent else False)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
def do_test_migration(self, persistent, migrate_bitmaps, online,
|
|
|
7711c0 |
shared_storage):
|
|
|
7711c0 |
granularity = 512
|
|
|
7711c0 |
@@ -152,7 +204,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase):
|
|
|
7711c0 |
|
|
|
7711c0 |
def inject_test_case(klass, name, method, *args, **kwargs):
|
|
|
7711c0 |
mc = operator.methodcaller(method, *args, **kwargs)
|
|
|
7711c0 |
- setattr(klass, 'test_' + name, new.instancemethod(mc, None, klass))
|
|
|
7711c0 |
+ setattr(klass, 'test_' + method + name, new.instancemethod(mc, None, klass))
|
|
|
7711c0 |
|
|
|
7711c0 |
for cmb in list(itertools.product((True, False), repeat=4)):
|
|
|
7711c0 |
name = ('_' if cmb[0] else '_not_') + 'persistent_'
|
|
|
7711c0 |
@@ -163,6 +215,12 @@ for cmb in list(itertools.product((True, False), repeat=4)):
|
|
|
7711c0 |
inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration',
|
|
|
7711c0 |
*list(cmb))
|
|
|
7711c0 |
|
|
|
7711c0 |
+for cmb in list(itertools.product((True, False), repeat=2)):
|
|
|
7711c0 |
+ name = ('_' if cmb[0] else '_not_') + 'persistent_'
|
|
|
7711c0 |
+ name += ('_' if cmb[1] else '_not_') + 'migbitmap'
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ inject_test_case(TestDirtyBitmapMigration, name,
|
|
|
7711c0 |
+ 'do_test_migration_resume_source', *list(cmb))
|
|
|
7711c0 |
|
|
|
7711c0 |
if __name__ == '__main__':
|
|
|
7711c0 |
iotests.main(supported_fmts=['qcow2'])
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/169.out b/tests/qemu-iotests/169.out
|
|
|
7711c0 |
index b6f2576..3a89159 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/169.out
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/169.out
|
|
|
7711c0 |
@@ -1,5 +1,5 @@
|
|
|
7711c0 |
-................
|
|
|
7711c0 |
+....................
|
|
|
7711c0 |
----------------------------------------------------------------------
|
|
|
7711c0 |
-Ran 16 tests
|
|
|
7711c0 |
+Ran 20 tests
|
|
|
7711c0 |
|
|
|
7711c0 |
OK
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|