|
|
0b05ab |
From 0b6f818f46e3b7c5b9be33216ef8438f59d7bcf1 Mon Sep 17 00:00:00 2001
|
|
|
0b05ab |
From: David Lehman <dlehman@redhat.com>
|
|
|
0b05ab |
Date: Thu, 18 Oct 2018 10:07:31 -0400
|
|
|
0b05ab |
Subject: [PATCH] Wipe all stale metadata after creating md array. (#1639682)
|
|
|
0b05ab |
|
|
|
0b05ab |
---
|
|
|
0b05ab |
blivet/devices/md.py | 4 ++++
|
|
|
0b05ab |
tests/devices_test/device_methods_test.py | 3 ++-
|
|
|
0b05ab |
2 files changed, 6 insertions(+), 1 deletion(-)
|
|
|
0b05ab |
|
|
|
0b05ab |
diff --git a/blivet/devices/md.py b/blivet/devices/md.py
|
|
|
0b05ab |
index dad099e8..6a837df0 100644
|
|
|
0b05ab |
--- a/blivet/devices/md.py
|
|
|
0b05ab |
+++ b/blivet/devices/md.py
|
|
|
0b05ab |
@@ -31,6 +31,7 @@
|
|
|
0b05ab |
from ..devicelibs import mdraid, raid
|
|
|
0b05ab |
|
|
|
0b05ab |
from .. import errors
|
|
|
0b05ab |
+from ..formats import DeviceFormat
|
|
|
0b05ab |
from .. import util
|
|
|
0b05ab |
from ..static_data import pvs_info
|
|
|
0b05ab |
from ..storage_log import log_method_call
|
|
|
0b05ab |
@@ -563,6 +564,9 @@ def remove_stale_lvm():
|
|
|
0b05ab |
|
|
|
0b05ab |
remove_stale_lvm()
|
|
|
0b05ab |
|
|
|
0b05ab |
+ # remove any other stale metadata before proceeding
|
|
|
0b05ab |
+ DeviceFormat(device=self.path, exists=True).destroy()
|
|
|
0b05ab |
+
|
|
|
0b05ab |
def _create(self):
|
|
|
0b05ab |
""" Create the device. """
|
|
|
0b05ab |
log_method_call(self, self.name, status=self.status)
|
|
|
0b05ab |
diff --git a/tests/devices_test/device_methods_test.py b/tests/devices_test/device_methods_test.py
|
|
|
0b05ab |
index 8e40e6b6..12d5f7d8 100644
|
|
|
0b05ab |
--- a/tests/devices_test/device_methods_test.py
|
|
|
0b05ab |
+++ b/tests/devices_test/device_methods_test.py
|
|
|
0b05ab |
@@ -404,6 +404,7 @@ def test_setup(self):
|
|
|
0b05ab |
self.assertTrue(self.patches["md"].activate.called)
|
|
|
0b05ab |
|
|
|
0b05ab |
def test_create(self):
|
|
|
0b05ab |
- super(MDRaidArrayDeviceMethodsTestCase, self).test_create()
|
|
|
0b05ab |
+ with patch("blivet.devices.md.DeviceFormat"):
|
|
|
0b05ab |
+ super(MDRaidArrayDeviceMethodsTestCase, self).test_create()
|
|
|
0b05ab |
self.device._create()
|
|
|
0b05ab |
self.assertTrue(self.patches["md"].create.called)
|