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