summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmdline.py10
-rwxr-xr-xgui.py45
-rw-r--r--storage/__init__.py1
-rw-r--r--storage/devicetree.py56
-rw-r--r--text.py45
5 files changed, 115 insertions, 42 deletions
diff --git a/cmdline.py b/cmdline.py
index 24485f76f..700e74148 100644
--- a/cmdline.py
+++ b/cmdline.py
@@ -144,6 +144,16 @@ class InstallInterface:
while 1:
time.sleep(5)
+ def resetReinitInconsistentLVMQuestion(self):
+ pass
+
+ def questionReinitInconsistentLVM(self, pv_names=None, lv_name=None, vg_name=None):
+ print(_("Can't have a question in command line mode!"))
+ print("(questionReinitInconsistentLVM)")
+ # don't exit
+ while 1:
+ time.sleep(5)
+
def mainExceptionWindow(self, shortText, longTextFile):
print(shortText)
diff --git a/gui.py b/gui.py
index 2f9f9258c..ea83c0837 100755
--- a/gui.py
+++ b/gui.py
@@ -988,6 +988,7 @@ class InstallInterface:
cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)
root.set_cursor(cursor)
self._initLabelAnswers = {}
+ self._inconsistentLVMAnswers = {}
def __del__ (self):
pass
@@ -1160,6 +1161,50 @@ class InstallInterface:
self._initLabelAnswers[path] = retVal
return retVal
+ def resetReinitInconsistentLVMQuestion(self):
+ self._inconsistentLVMAnswers = {}
+
+ def questionReinitInconsistentLVM(self, pv_names=None, lv_name=None, vg_name=None):
+
+ retVal = False # The less destructive default
+
+ if not pv_names or (lv_name is None and vg_name is None):
+ return retVal
+
+ # We are caching answers so that we don't ask for ignoring
+ # in each storage.reset() again (note that reinitialization is
+ # done right after confirmation in dialog, not as a planned
+ # action).
+ key = frozenset(pv_names)
+ if key in self._inconsistentLVMAnswers:
+ log.info("UI not asking about disk initialization, "
+ "using cached answer: %s" % self._inconsistentLVMAnswers[key])
+ return self._inconsistentLVMAnswers[key]
+
+ if vg_name is not None:
+ message = "Volume Group %s" % vg_name
+ elif lv_name is not None:
+ message = "Logical Volume %s" % lv_name
+
+ na = {'msg': message, 'pvs': ", ".join(pv_names)}
+ rc = self.messageWindow(_("Warning"),
+ _("Error processing LVM.\n"
+ "There is inconsistent LVM data on %(msg)s. You can "
+ "reinitialize all related PVs (%(pvs)s) which will erase "
+ "the LVM metadata, or ignore which will preserve the "
+ "contents.") % na,
+ type="custom",
+ custom_buttons = [ _("_Ignore"),
+ _("_Re-initialize") ],
+ custom_icon="question")
+ if rc == 0:
+ pass
+ else:
+ retVal = True # this means clobber.
+
+ self._inconsistentLVMAnswers[key] = retVal
+ return retVal
+
def beep(self):
gtk.gdk.beep()
diff --git a/storage/__init__.py b/storage/__init__.py
index c7483623a..eb4d69faf 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -80,6 +80,7 @@ def storageInitialize(anaconda):
anaconda.intf.resetInitializeDiskQuestion()
+ anaconda.intf.resetReinitInconsistentLVMQuestion()
# Set up the protected partitions list now.
if os.path.exists("/dev/live") and \
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 81cd2701a..82b7418f1 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -127,34 +127,6 @@ def getLUKSPassphrase(intf, device, globalPassphrase):
return (passphrase, isglobal)
-def questionReinitILVM(intf=None, pv_names=None, lv_name=None, vg_name=None):
- retVal = False # The less destructive default
- if not intf or not pv_names or (lv_name is None and vg_name is None):
- pass
- else:
- if vg_name is not None:
- message = "Volume Group %s" % vg_name
- elif lv_name is not None:
- message = "Logical Volume %s" % lv_name
-
- na = {'msg': message, 'pvs': ", ".join(pv_names)}
- rc = intf.messageWindow(_("Warning"),
- _("Error processing LVM.\n"
- "There is inconsistent LVM data on %(msg)s. You can "
- "reinitialize all related PVs (%(pvs)s) which will erase "
- "the LVM metadata, or ignore which will preserve the "
- "contents.") % na,
- type="custom",
- custom_buttons = [ _("_Ignore"),
- _("_Re-initialize") ],
- custom_icon="question")
- if rc == 0:
- pass
- else:
- retVal = True # thie means clobber.
-
- return retVal
-
class DeviceTree(object):
""" A quasi-tree that represents the devices in the system.
@@ -1802,17 +1774,19 @@ class DeviceTree(object):
def leafInconsistencies(device):
if device.type == "lvmvg":
+ if device.complete:
+ return
+
paths = []
for parent in device.parents:
paths.append(parent.path)
- # when zeroMbr is true he wont ask.
- if not device.complete and (self.zeroMbr or \
- questionReinitILVM(intf=self.intf, \
- vg_name=device.name, pv_names=paths)):
+ # if zeroMbr is true don't ask.
+ if (self.zeroMbr or
+ self.intf.questionReinitInconsistentLVM(pv_names=paths,
+ vg_name=device.name)):
reinitializeVG(device)
-
- elif not device.complete:
+ else:
# The user chose not to reinitialize.
# hopefully this will ignore the vg components too.
self._removeDevice(device)
@@ -1827,21 +1801,21 @@ class DeviceTree(object):
self.addIgnoredDisk(parent.name)
lvm.lvm_cc_addFilterRejectRegexp(parent.name)
- return
-
elif device.type == "lvmlv":
# we might have already fixed this.
if device not in self._devices or \
device.name in self._ignoredDisks:
return
+ if device.complete:
+ return
paths = []
for parent in device.vg.parents:
paths.append(parent.path)
- if not device.complete and (self.zeroMbr or \
- questionReinitILVM(intf=self.intf, \
- lv_name=device.name, pv_names=paths)):
+ if (self.zeroMbr or
+ self.intf.questionReinitInconsistentLVM(pv_names=paths,
+ lv_name=device.name)):
# destroy all lvs.
for lv in device.vg.lvs:
@@ -1856,8 +1830,7 @@ class DeviceTree(object):
self._removeDevice(lv)
reinitializeVG(device.vg)
-
- elif not device.complete:
+ else:
# ignore all the lvs.
for lv in device.vg.lvs:
self._removeDevice(lv)
@@ -1875,7 +1848,6 @@ class DeviceTree(object):
self._removeDevice(parent, moddisk=False)
self.addIgnoredDisk(parent.name)
lvm.lvm_cc_addFilterRejectRegexp(parent.name)
- return
# Address the inconsistencies present in the tree leaves.
for leaf in self.leaves:
diff --git a/text.py b/text.py
index 6972417ec..c4602cd6e 100644
--- a/text.py
+++ b/text.py
@@ -438,6 +438,7 @@ class InstallInterface:
signal.signal(signal.SIGTSTP, signal.SIG_IGN)
self.screen = SnackScreen()
self._initLabelAnswers = {}
+ self._inconsistentLVMAnswers = {}
def __del__(self):
if self.screen:
@@ -490,6 +491,50 @@ class InstallInterface:
self._initLabelAnswers[path] = retVal
return retVal
+ def resetReinitInconsistentLVMQuestion(self):
+ self._inconsistentLVMAnswers = {}
+
+ def questionReinitInconsistentLVM(self, pv_names=None, lv_name=None, vg_name=None):
+
+ retVal = False # The less destructive default
+
+ if not pv_names or (lv_name is None and vg_name is None):
+ return retVal
+
+ # We are caching answers so that we don't ask for ignoring
+ # in each storage.reset() again (note that reinitialization is
+ # done right after confirmation in dialog, not as a planned
+ # action).
+ key = frozenset(pv_names)
+ if key in self._inconsistentLVMAnswers:
+ log.info("UI not asking about disk initialization, "
+ "using cached answer: %s" % self._inconsistentLVMAnswers[key])
+ return self._inconsistentLVMAnswers[key]
+
+ if vg_name is not None:
+ message = "Volume Group %s" % vg_name
+ elif lv_name is not None:
+ message = "Logical Volume %s" % lv_name
+
+ na = {'msg': message, 'pvs': ", ".join(pv_names)}
+ rc = self.messageWindow(_("Warning"),
+ _("Error processing LVM.\n"
+ "There is inconsistent LVM data on %(msg)s. You can "
+ "reinitialize all related PVs (%(pvs)s) which will erase "
+ "the LVM metadata, or ignore which will preserve the "
+ "contents.") % na,
+ type="custom",
+ custom_buttons = [ _("_Ignore"),
+ _("_Re-initialize") ],
+ custom_icon="question")
+ if rc == 0:
+ pass
+ else:
+ retVal = True # this means clobber.
+
+ self._inconsistentLVMAnswers[key] = retVal
+ return retVal
+
def run(self, anaconda):
self.anaconda = anaconda
instLang = anaconda.id.instLanguage