neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone

Blame SOURCES/0007-Wipe-all-stale-metadata-after-creating-md-array.patch

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