From 5c7b6ee2035626027893cd4d890b9469a0aa2168 Mon Sep 17 00:00:00 2001 From: Radek Vykydal Date: Thu, 7 Jan 2010 09:59:32 +0100 Subject: Ask about LVM inconsistencies only in storageinit step. The patch does essentially the same thing as commit 31d5b8f4fec513e4f8e246e47e9fee75c701d07b for disk initialization question. The difference is that when user chooses LVM reinitialization, it is done immediately (not as planned action as with disk initialization) so the user wouldn't be asked again anyway without the patch (he would be asked if he chose to ignore). I also made one function more readable in the patch. --- text.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'text.py') 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 -- cgit