[rhel6-branch] Rescan all disks when moving back through UI (#804557)
Vratislav Podzimek
vpodzime at redhat.com
Tue Sep 18 06:48:35 UTC 2012
Looks good to me.
On Mon, 2012-09-17 at 11:05 -0700, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl at redhat.com>
>
> When the user has selected a clearPartType it can interfere with the
> discovery of partitions to be upgraded when moving back through the UI
> to sections before clearPartType selection, or to before the upgrade
> screen.
>
> This fixes those cases by adding a new option to storage.reset, named
> examine_all, that when set to True will cause it to reexamine all disks
> regardless of the clearPartType setting.
>
> Resolves: rhbz#804557
> ---
> anaconda | 2 +-
> iw/autopart_type.py | 5 +----
> iw/examine_gui.py | 5 +----
> storage/__init__.py | 22 ++++++++++++++++------
> textw/upgrade_text.py | 11 +++++++++++
> 5 files changed, 30 insertions(+), 15 deletions(-)
>
> diff --git a/anaconda b/anaconda
> index c2ebe76..0e566f3 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -1111,7 +1111,7 @@ if __name__ == "__main__":
> if ksdata.clearpart.initAll:
> anaconda.id.storage.reinitializeDisks = ksdata.clearpart.initAll
>
> - storage.storageInitialize(anaconda)
> + storage.storageInitialize(anaconda, examine_all=False)
>
> # Now having initialized storage, we can apply all the other kickstart
> # commands. This gives us the ability to check that storage commands
> diff --git a/iw/autopart_type.py b/iw/autopart_type.py
> index 3179ebe..d1e64b4 100644
> --- a/iw/autopart_type.py
> +++ b/iw/autopart_type.py
> @@ -157,10 +157,7 @@ class PartitionTypeWindow(InstallWindow):
> # found during storage reset
> if not self._isInteractiveKS() or \
> (self._isInteractiveKS() and len(self.storage.devicetree.findActions(type="create")) == 0):
> - clearPartType = self.anaconda.id.storage.clearPartType
> - self.anaconda.id.storage.clearPartType = None
> - self.anaconda.id.storage.reset()
> - self.anaconda.id.storage.clearPartType = clearPartType
> + self.anaconda.id.storage.reset(examine_all=True)
>
> self.storage.clearPartChoice = self.buttonGroup.getCurrent()
>
> diff --git a/iw/examine_gui.py b/iw/examine_gui.py
> index d1099cf..02e3969 100644
> --- a/iw/examine_gui.py
> +++ b/iw/examine_gui.py
> @@ -95,10 +95,7 @@ class UpgradeExamineWindow (InstallWindow):
> # moving forward from autopart, not back.
> # temporarily unset storage.clearPartType so that all devices will be
> # found during storage reset
> - clearPartType = self.anaconda.id.storage.clearPartType
> - self.anaconda.id.storage.clearPartType = None
> - self.anaconda.id.storage.reset()
> - self.anaconda.id.storage.clearPartType = clearPartType
> + self.anaconda.id.storage.reset(examine_all=True)
>
> # we might get here after storage reset that obsoleted
> # root device objects we had found
> diff --git a/storage/__init__.py b/storage/__init__.py
> index 7610d70..34bf04b 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -64,9 +64,14 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
> import logging
> log = logging.getLogger("storage")
>
> -def storageInitialize(anaconda):
> - storage = anaconda.id.storage
> +def storageInitialize(anaconda, examine_all=True):
> + """ Initialize the storage system
>
> + Setting examine_all to False will use clearPartType to
> + determine which disks will be used. This should be set to False
> + for kickstart and True for everything else.
> + """
> + storage = anaconda.id.storage
> storage.shutdown()
>
> if anaconda.dir == DISPATCH_BACK:
> @@ -87,7 +92,7 @@ def storageInitialize(anaconda):
> # Set up the protected partitions list now.
> if anaconda.protected:
> storage.protectedDevSpecs.extend(anaconda.protected)
> - storage.reset()
> + storage.reset(examine_all=examine_all)
>
> if not flags.livecdInstall and not storage.protectedDevices:
> if anaconda.id.getUpgrade():
> @@ -100,7 +105,7 @@ def storageInitialize(anaconda):
> type="custom", custom_buttons = [_("_Exit installer")])
> sys.exit(1)
> else:
> - storage.reset()
> + storage.reset(examine_all=examine_all)
>
> if not storage.disks:
> custom_buttons=[_("_Try again"), _("_Exit installer")]
> @@ -395,9 +400,14 @@ class Storage(object):
>
> # TODO: iscsi.shutdown()
>
> - def reset(self):
> + def reset(self, examine_all=False):
> """ Reset storage configuration to reflect actual system state.
>
> + Setting examine_all will cause it to examine all devices regardless
> + of the clearPartType setting which could cause it to skip some
> + devices. This is useful when looking for existing partitions to be
> + upgraded.
> +
> This should rescan from scratch but not clobber user-obtained
> information like passphrases, iscsi config, &c
>
> @@ -415,7 +425,7 @@ class Storage(object):
> self.fcoe.startup(self.anaconda.intf)
> self.zfcp.startup(self.anaconda.intf)
> self.dasd.startup(self.anaconda.intf, self.exclusiveDisks, self.zeroMbr)
> - if self.anaconda.id.getUpgrade():
> + if examine_all:
> clearPartType = CLEARPART_TYPE_NONE
> else:
> clearPartType = self.clearPartType
> diff --git a/textw/upgrade_text.py b/textw/upgrade_text.py
> index 464782d..64cfe78 100644
> --- a/textw/upgrade_text.py
> +++ b/textw/upgrade_text.py
> @@ -206,6 +206,17 @@ class UpgradeSwapWindow:
>
> class UpgradeExamineWindow:
> def __call__ (self, screen, anaconda):
> + if anaconda.dir == DISPATCH_BACK:
> + # reset storage to catch any changes
> + anaconda.id.storage.reset(examine_all=True)
> +
> + # we might get here after storage reset that obsoleted
> + # root device objects we had found
> + if not anaconda.id.rootParts:
> + anaconda.id.rootParts = upgrade.findExistingRoots(anaconda,
> + flags.cmdline.has_key("upgradeany"))
> + upgrade.setUpgradeRoot(anaconda)
> +
> parts = anaconda.id.rootParts
>
> height = min(len(parts), 11) + 1
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list