26ba25
From 3df2da67983b88351cbe4e8d0169cc40cc5ab282 Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Tue, 20 Nov 2018 18:18:27 +0000
26ba25
Subject: [PATCH 33/35] iotests: improve 169
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20181120181828.15132-24-jsnow@redhat.com>
26ba25
Patchwork-id: 83072
26ba25
O-Subject: [RHEL8/rhel qemu-kvm PATCH 23/24] iotests: improve 169
26ba25
Bugzilla: 1518989
26ba25
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
26ba25
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
26ba25
26ba25
Before previous patch, iotest 169 was actually broken for the case
26ba25
test_persistent__not_migbitmap__offline_shared, while formally
26ba25
passing.
26ba25
26ba25
After migration log of vm_b had message:
26ba25
26ba25
    qemu-system-x86_64: Could not reopen qcow2 layer: Bitmap already
26ba25
    exists: bitmap0
26ba25
26ba25
which means that invalidation failed and bs->drv = NULL.
26ba25
26ba25
It was because we've loaded bitmap twice: on open and on invalidation.
26ba25
26ba25
Add code to 169, to catch such fails.
26ba25
26ba25
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
(cherry picked from commit b9247fc1a8ffe5c367fa049f295fbb58c8ca9d05)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 tests/qemu-iotests/169 | 9 +++++++++
26ba25
 1 file changed, 9 insertions(+)
26ba25
26ba25
diff --git a/tests/qemu-iotests/169 b/tests/qemu-iotests/169
26ba25
index df408f8..8b7947d 100755
26ba25
--- a/tests/qemu-iotests/169
26ba25
+++ b/tests/qemu-iotests/169
26ba25
@@ -24,6 +24,7 @@ import time
26ba25
 import itertools
26ba25
 import operator
26ba25
 import new
26ba25
+import re
26ba25
 from iotests import qemu_img
26ba25
 
26ba25
 
26ba25
@@ -133,6 +134,14 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase):
26ba25
 
26ba25
         if should_migrate:
26ba25
             self.vm_b.shutdown()
26ba25
+
26ba25
+            # catch 'Could not reopen qcow2 layer: Bitmap already exists'
26ba25
+            # possible error
26ba25
+            log = self.vm_b.get_log()
26ba25
+            log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
26ba25
+            log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
26ba25
+            self.assertEqual(log, '')
26ba25
+
26ba25
             # recreate vm_b, as we don't want -incoming option (this will lead
26ba25
             # to "cat" process left alive after test finish)
26ba25
             self.vm_b = iotests.VM(path_suffix='b')
26ba25
-- 
26ba25
1.8.3.1
26ba25