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