From 7ea42d120f84005dce27a9d3ca98732c929999ab Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 21 Dec 2009 13:10:13 -0500 Subject: Move storage into the Anaconda class. --- anaconda | 25 +++++++--- backend.py | 6 +-- bootloader.py | 14 +++--- booty/bootloaderInfo.py | 4 +- exception.py | 2 +- installclasses/fedora.py | 2 +- installclasses/rhel.py | 2 +- installmethod.py | 6 +-- instdata.py | 2 - iw/advanced_storage.py | 18 +++---- iw/autopart_type.py | 2 +- iw/bootloader_main_gui.py | 8 ++-- iw/cleardisks_gui.py | 24 +++++----- iw/filter_gui.py | 12 ++--- iw/lvm_dialog_gui.py | 2 +- iw/osbootwidget.py | 2 +- iw/partition_dialog_gui.py | 4 +- iw/partition_gui.py | 6 +-- iw/task_gui.py | 4 +- iw/upgrade_bootloader_gui.py | 2 +- iw/upgrade_migratefs_gui.py | 4 +- iw/upgrade_swap_gui.py | 2 +- kickstart.py | 46 +++++++++--------- livecd.py | 24 +++++----- network.py | 4 +- packages.py | 22 ++++----- partIntfHelpers.py | 4 +- platform.py | 22 ++++----- rescue.py | 4 +- storage/__init__.py | 32 ++++++------- storage/iscsi.py | 4 +- storage/partitioning.py | 100 +++++++++++++++++++-------------------- textw/partition_text.py | 32 ++++++------- textw/upgrade_bootloader_text.py | 2 +- textw/upgrade_text.py | 6 +-- upgrade.py | 8 ++-- yuminstall.py | 20 ++++---- 37 files changed, 246 insertions(+), 237 deletions(-) diff --git a/anaconda b/anaconda index 382e0a909..2efb173bd 100755 --- a/anaconda +++ b/anaconda @@ -466,6 +466,7 @@ class Anaconda(object): self.rootPath = "/mnt/sysimage" self.security = security.Security() self.stage2 = None + self._storage = None self._timezone = None self.updateSrc = None self.upgrade = flags.cmdline.has_key("preupgrade") @@ -558,6 +559,14 @@ class Anaconda(object): return self._users + @property + def storage(self): + if not self._storage: + import storage + self._storage = storage.Storage(self) + + return self._storage + @property def timezone(self): if not self._timezone: @@ -722,6 +731,8 @@ class Anaconda(object): self.security.writeKS(f) self.firewall.writeKS(f) + self.storage.writeKS(f) + # XXX: This is temporary until instdata goes away completely. self.id.writeKS(f) @@ -1147,15 +1158,15 @@ if __name__ == "__main__": # Before we set up the storage system, we need to know which disks to # ignore, etc. Luckily that's all in the kickstart data. - anaconda.id.storage.zeroMbr = anaconda.ksdata.zerombr.zerombr - anaconda.id.storage.ignoredDisks = anaconda.ksdata.ignoredisk.ignoredisk - anaconda.id.storage.exclusiveDisks = anaconda.ksdata.ignoredisk.onlyuse + anaconda.storage.zeroMbr = anaconda.ksdata.zerombr.zerombr + anaconda.storage.ignoredDisks = anaconda.ksdata.ignoredisk.ignoredisk + anaconda.storage.exclusiveDisks = anaconda.ksdata.ignoredisk.onlyuse if anaconda.ksdata.clearpart.type is not None: - anaconda.id.storage.clearPartType = anaconda.ksdata.clearpart.type - anaconda.id.storage.clearPartDisks = anaconda.ksdata.clearpart.drives + anaconda.storage.clearPartType = anaconda.ksdata.clearpart.type + anaconda.storage.clearPartDisks = anaconda.ksdata.clearpart.drives if anaconda.ksdata.clearpart.initAll: - anaconda.id.storage.reinitializeDisks = anaconda.ksdata.clearpart.initAll + anaconda.storage.reinitializeDisks = anaconda.ksdata.clearpart.initAll storage.storageInitialize(anaconda) @@ -1179,7 +1190,7 @@ if __name__ == "__main__": anaconda.intf.shutdown() if anaconda.ksdata and anaconda.ksdata.reboot.eject: - for drive in anaconda.id.storage.devicetree.devices: + for drive in anaconda.storage.devicetree.devices: if drive.type != "cdrom": continue diff --git a/backend.py b/backend.py index 268225f96..45dcb3c06 100644 --- a/backend.py +++ b/backend.py @@ -87,8 +87,8 @@ class AnacondaBackend: # the initrd might need iscsi-initiator-utils, and chances are # it was not installed yet the first time mkinitrd was run, as # mkinitrd does not require it. - root = anaconda.id.storage.rootDevice - disks = anaconda.id.storage.devicetree.getDevicesByType("iscsi") + root = anaconda.storage.rootDevice + disks = anaconda.storage.devicetree.getDevicesByType("iscsi") for disk in disks: if root.dependsOn(disk): has_iscsi_disk = True @@ -156,7 +156,7 @@ class AnacondaBackend: # If we've booted off the first CD (so, not the boot.iso or DVD) then # copy the install.img to the filesystem and switch loopback devices # to there. Otherwise we won't be able to unmount and swap media. - free = anaconda.id.storage.fsFreeSpace + free = anaconda.storage.fsFreeSpace self._loopbackFile = "%s%s/rhinstall-install.img" % (anaconda.rootPath, free[-1][0]) try: diff --git a/bootloader.py b/bootloader.py index b4dac5ba3..52604c429 100644 --- a/bootloader.py +++ b/bootloader.py @@ -72,7 +72,7 @@ def bootloaderSetupChoices(anaconda): if iutil.isEfi() and not anaconda.id.bootloader.device: bootPart = None - partitions = anaconda.id.storage.partitions + partitions = anaconda.storage.partitions for part in partitions: if part.partedPartition.active and isEfiSystemPartition(part.partedPartition): bootPart = part.name @@ -83,7 +83,7 @@ def bootloaderSetupChoices(anaconda): # iSeries bootloader on upgrades if iutil.getPPCMachine() == "iSeries" and not anaconda.id.bootloader.device: bootPart = None - partitions = anaconda.id.storage.partitions + partitions = anaconda.storage.partitions for part in partitions: if part.partedPartition.active and \ part.partedPartition.getFlag(parted.PARTITION_PREP): @@ -99,7 +99,7 @@ def bootloaderSetupChoices(anaconda): anaconda.dispatch.skipStep("instbootloader", skip = 0) # FIXME: ... - anaconda.id.bootloader.images.setup(anaconda.id.storage) + anaconda.id.bootloader.images.setup(anaconda.storage) if anaconda.id.bootloader.defaultDevice != None and choices: keys = choices.keys() @@ -125,7 +125,7 @@ def fixedMdraidGrubTarget(anaconda, grubTarget): try: if float(version) < 12: stage1Devs = anaconda.id.bootloader.getPhysicalDevices(grubTarget) - fixedGrubTarget = getDiskPart(stage1Devs[0], anaconda.id.storage)[0] + fixedGrubTarget = getDiskPart(stage1Devs[0], anaconda.storage)[0] log.info("Mdraid grub upgrade: %s -> %s" % (grubTarget, fixedGrubTarget)) except ValueError: @@ -143,7 +143,7 @@ def writeBootloader(anaconda): return if anaconda.id.bootloader.doUpgradeOnly: - (bootType, theDev) = checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.id.storage) + (bootType, theDev) = checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.storage) anaconda.id.bootloader.doUpgradeonly = 1 if bootType == "GRUB": @@ -160,12 +160,12 @@ def writeBootloader(anaconda): kernelList = [] otherList = [] # getDefault needs to return a device, but that's too invasive for now. - rootDev = anaconda.id.storage.rootDevice + rootDev = anaconda.storage.rootDevice if not anaconda.id.bootloader.images.getDefault(): defaultDev = None else: - defaultDev = anaconda.id.storage.devicetree.getDeviceByName(anaconda.id.bootloader.images.getDefault()) + defaultDev = anaconda.storage.devicetree.getDeviceByName(anaconda.id.bootloader.images.getDefault()) kernelLabel = None kernelLongLabel = None diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index a4fa62f09..21e4c4160 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -89,8 +89,8 @@ class KernelArguments: def getDracutStorageArgs(self): args = [] types = {} - root = self.id.storage.rootDevice - for d in self.id.storage.devices: + root = self.anaconda.storage.rootDevice + for d in self.anaconda.storage.devices: if root.dependsOn(d): dracutSetupString = d.dracutSetupString() if len(dracutSetupString): diff --git a/exception.py b/exception.py index 16c982265..f032a6d80 100644 --- a/exception.py +++ b/exception.py @@ -109,7 +109,7 @@ def initExceptionHandling(anaconda): "instLanguage.tz", "keyboard._mods._modelDict", "keyboard.modelDict", - "id.storage.encryptionPassphrase", + "storage.encryptionPassphrase", "users.rootPassword", "id.tmpData", "intf.icw.buff", diff --git a/installclasses/fedora.py b/installclasses/fedora.py index 23d174b0d..4b19258d7 100644 --- a/installclasses/fedora.py +++ b/installclasses/fedora.py @@ -76,7 +76,7 @@ class InstallClass(BaseInstallClass): def setInstallData(self, anaconda): BaseInstallClass.setInstallData(self, anaconda) BaseInstallClass.setDefaultPartitioning(self, - anaconda.id.storage, + anaconda.storage, anaconda.platform) def setGroupSelection(self, anaconda): diff --git a/installclasses/rhel.py b/installclasses/rhel.py index 9bb85ff6d..9f213767a 100644 --- a/installclasses/rhel.py +++ b/installclasses/rhel.py @@ -99,7 +99,7 @@ class InstallClass(BaseInstallClass): def setInstallData(self, anaconda): BaseInstallClass.setInstallData(self, anaconda) BaseInstallClass.setDefaultPartitioning(self, - anaconda.id.storage, + anaconda.storage, anaconda.platform) def setGroupSelection(self, anaconda): diff --git a/installmethod.py b/installmethod.py index 87ffa3cb4..17f1d3ae5 100644 --- a/installmethod.py +++ b/installmethod.py @@ -34,12 +34,12 @@ def doMethodComplete(anaconda): return None if anaconda.mediaDevice: - return anaconda.id.storage.devicetree.getDeviceByName(anaconda.mediaDevice) + return anaconda.storage.devicetree.getDeviceByName(anaconda.mediaDevice) # If we booted off the boot.iso instead of disc 1, eject that as well. if anaconda.stage2 and anaconda.stage2.startswith("cdrom://"): dev = anaconda.stage2[8:].split(':')[0] - return anaconda.id.storage.devicetree.getDeviceByName(dev) + return anaconda.storage.devicetree.getDeviceByName(dev) anaconda.backend.complete(anaconda) dev = _ejectDevice() @@ -47,7 +47,7 @@ def doMethodComplete(anaconda): dev.eject() mtab = "/dev/root / ext3 ro 0 0\n" - rootDevice = anaconda.id.storage.rootDevice + rootDevice = anaconda.storage.rootDevice if rootDevice: mtab = "/dev/root / %s ro 0 0\n" % rootDevice.format.type diff --git a/instdata.py b/instdata.py index fefcd5dfe..03636212c 100644 --- a/instdata.py +++ b/instdata.py @@ -51,7 +51,6 @@ class InstallData: # # - The install language - self.storage = storage.Storage(self.anaconda) self.bootloader = booty.getBootloader(self) self.escrowCertificates = {} @@ -62,7 +61,6 @@ class InstallData: def writeKS(self, f): self.bootloader.writeKS(f) - self.storage.writeKS(f) def __init__(self, anaconda, extraModules): self.anaconda = anaconda diff --git a/iw/advanced_storage.py b/iw/advanced_storage.py index c6fbf5f3b..902d8ac4a 100644 --- a/iw/advanced_storage.py +++ b/iw/advanced_storage.py @@ -93,9 +93,9 @@ def addFcoeDrive(anaconda): continue try: - anaconda.id.storage.fcoe.addSan(store.get_value(iter, 1), - dcb=dcb_cb.get_active(), - intf=anaconda.intf) + anaconda.storage.fcoe.addSan(store.get_value(iter, 1), + dcb=dcb_cb.get_active(), + intf=anaconda.intf) except IOError as e: anaconda.intf.messageWindow(_("Error"), str(e)) rc = gtk.RESPONSE_CANCEL @@ -124,8 +124,8 @@ def addIscsiDrive(anaconda): # get the initiator name if it exists and don't allow changing # once set e = dxml.get_widget("iscsiInitiatorEntry") - e.set_text(anaconda.id.storage.iscsi.initiator) - if anaconda.id.storage.iscsi.initiatorSet: + e.set_text(anaconda.storage.iscsi.initiator) + if anaconda.storage.iscsi.initiatorSet: e.set_sensitive(False) while True: @@ -139,7 +139,7 @@ def addIscsiDrive(anaconda): _("You must provide an initiator name.")) continue - anaconda.id.storage.iscsi.initiator = initiator + anaconda.storage.iscsi.initiator = initiator target = dxml.get_widget("iscsiAddrEntry").get_text().strip() user = dxml.get_widget("userEntry").get_text().strip() @@ -169,9 +169,9 @@ def addIscsiDrive(anaconda): continue try: - anaconda.id.storage.iscsi.addTarget(ip, port, user, pw, - user_in, pw_in, - anaconda.intf) + anaconda.storage.iscsi.addTarget(ip, port, user, pw, + user_in, pw_in, + anaconda.intf) except ValueError as e: anaconda.intf.messageWindow(_("Error"), str(e)) continue diff --git a/iw/autopart_type.py b/iw/autopart_type.py index 9134e68a1..ca5c0c966 100644 --- a/iw/autopart_type.py +++ b/iw/autopart_type.py @@ -211,7 +211,7 @@ class PartitionTypeWindow(InstallWindow): def getScreen(self, anaconda): self.anaconda = anaconda - self.storage = anaconda.id.storage + self.storage = anaconda.storage self.intf = anaconda.intf self.dispatch = anaconda.dispatch diff --git a/iw/bootloader_main_gui.py b/iw/bootloader_main_gui.py index fa5d5543d..b2cde964c 100644 --- a/iw/bootloader_main_gui.py +++ b/iw/bootloader_main_gui.py @@ -134,8 +134,8 @@ class MainBootloaderWindow(InstallWindow): lbl = dxml.get_widget("bd%dLabel" %(i,)) combo.show() lbl.show() - partitioned = anaconda.id.storage.partitioned - disks = anaconda.id.storage.disks + partitioned = anaconda.storage.partitioned + disks = anaconda.storage.disks bl_disks = [d for d in disks if d in partitioned] m = __genStore(combo, bl_disks, self.driveorder[i - 1]) @@ -193,8 +193,8 @@ class MainBootloaderWindow(InstallWindow): self.driveorder = self.bl.drivelist if len(self.driveorder) == 0: - partitioned = anaconda.id.storage.partitioned - disks = anaconda.id.storage.disks + partitioned = anaconda.storage.partitioned + disks = anaconda.storage.disks self.driveorder = [d.name for d in disks if d in partitioned] if self.bl.getPassword(): diff --git a/iw/cleardisks_gui.py b/iw/cleardisks_gui.py index 23758999c..032555b12 100644 --- a/iw/cleardisks_gui.py +++ b/iw/cleardisks_gui.py @@ -58,17 +58,17 @@ class ClearDisksWindow (InstallWindow): bootDisk = selected[0][OBJECT_COL].name - cleardisks.sort(self.anaconda.id.storage.compareDisks) + cleardisks.sort(self.anaconda.storage.compareDisks) - self.anaconda.id.storage.clearPartDisks = cleardisks + self.anaconda.storage.clearPartDisks = cleardisks self.anaconda.id.bootloader.updateDriveList([bootDisk]) def getScreen (self, anaconda): # Skip this screen as well if we only had one disk available in the # filtering UI. - if len(anaconda.id.storage.exclusiveDisks) == 1: - anaconda.id.storage.clearPartDisks = anaconda.id.storage.exclusiveDisks - anaconda.id.bootloader.drivelist = anaconda.id.storage.exclusiveDisks + if len(anaconda.storage.exclusiveDisks) == 1: + anaconda.storage.clearPartDisks = anaconda.storage.exclusiveDisks + anaconda.id.bootloader.drivelist = anaconda.storage.exclusiveDisks return None (xml, self.vbox) = gui.getGladeWidget("cleardisks.glade", "vbox") @@ -135,19 +135,19 @@ class ClearDisksWindow (InstallWindow): # Store the first disk (according to our detected BIOS order) for # auto boot device selection - self.bootDisk = sorted(self.anaconda.id.storage.exclusiveDisks, - self.anaconda.id.storage.compareDisks)[0] + self.bootDisk = sorted(self.anaconda.storage.exclusiveDisks, + self.anaconda.storage.compareDisks)[0] # The device filtering UI set up exclusiveDisks as a list of the names # of all the disks we should use later on. Now we need to go get those, # look up some more information in the devicetree, and set up the # selector. - for d in self.anaconda.id.storage.exclusiveDisks: - device = self.anaconda.id.storage.devicetree.getDeviceByName(d) + for d in self.anaconda.storage.exclusiveDisks: + device = self.anaconda.storage.devicetree.getDeviceByName(d) if not device: continue - rightVisible = d in self.anaconda.id.storage.clearPartDisks + rightVisible = d in self.anaconda.storage.clearPartDisks rightActive = rightVisible and \ d in self.anaconda.id.bootloader.drivelist[:1] leftVisible = not rightVisible @@ -169,9 +169,9 @@ class ClearDisksWindow (InstallWindow): self.leftTreeView.get_selection().set_mode(gtk.SELECTION_MULTIPLE) self.rightTreeView.get_selection().set_mode(gtk.SELECTION_MULTIPLE) - if self.anaconda.id.storage.clearPartType == CLEARPART_TYPE_LINUX: + if self.anaconda.storage.clearPartType == CLEARPART_TYPE_LINUX: self.installTargetTip.set_markup(_("Tip: All Linux filesystems on install target devices will be reformatted and wiped of any data. Make sure you have backups.")) - elif self.anaconda.id.storage.clearPartType == CLEARPART_TYPE_ALL: + elif self.anaconda.storage.clearPartType == CLEARPART_TYPE_ALL: self.installTargetTip.set_markup(_("Tip: Install target devices will be reformatted and wiped of any data. Make sure you have backups.")) else: self.installTargetTip.set_markup(_("Tip: Your filesystems on install target devices will not be wiped unless you choose to do so during customization.")) diff --git a/iw/filter_gui.py b/iw/filter_gui.py index 67c642703..9901360c4 100644 --- a/iw/filter_gui.py +++ b/iw/filter_gui.py @@ -408,7 +408,7 @@ class FilterWindow(InstallWindow): custom_icon="error") raise gui.StayOnScreen - self.anaconda.id.storage.exclusiveDisks = list(selected) + self.anaconda.storage.exclusiveDisks = list(selected) def _add_advanced_clicked(self, button): from advanced_storage import addDrive @@ -555,7 +555,7 @@ class FilterWindow(InstallWindow): # cleardisks UI. Unfortunately, that means we need to duplicate # some of the getNext method. if len(singlepaths) == 1: - anaconda.id.storage.exclusiveDisks = [udev_device_get_name(singlepaths[0])] + anaconda.storage.exclusiveDisks = [udev_device_get_name(singlepaths[0])] return None self.pages = [self._makeBasic()] @@ -608,11 +608,11 @@ class FilterWindow(InstallWindow): totalSize += tuple[0]["XXX_SIZE"] def _active(name): - if self.anaconda.id.storage.exclusiveDisks and \ - name in self.anaconda.id.storage.exclusiveDisks: + if self.anaconda.storage.exclusiveDisks and \ + name in self.anaconda.storage.exclusiveDisks: return True - elif self.anaconda.id.storage.ignoredDisks and \ - name not in self.anaconda.id.storage.ignoredDisks: + elif self.anaconda.storage.ignoredDisks and \ + name not in self.anaconda.storage.ignoredDisks: return True else: return False diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py index 823a83629..7a98d9953 100644 --- a/iw/lvm_dialog_gui.py +++ b/iw/lvm_dialog_gui.py @@ -1165,7 +1165,7 @@ class VolumeGroupEditor: self.dialog = None def __init__(self, anaconda, intf, parent, vg, isNew = 0): - self.storage = anaconda.id.storage + self.storage = anaconda.storage # the vg instance we were passed self.vg = vg diff --git a/iw/osbootwidget.py b/iw/osbootwidget.py index fcde02721..d73786328 100644 --- a/iw/osbootwidget.py +++ b/iw/osbootwidget.py @@ -36,7 +36,7 @@ class OSBootWidget: def __init__(self, anaconda, parent, blname = None): self.bl = anaconda.id.bootloader - self.storage = anaconda.id.storage + self.storage = anaconda.storage self.parent = parent self.intf = anaconda.intf if blname is not None: diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py index 7f76c8630..920ee22b7 100644 --- a/iw/partition_dialog_gui.py +++ b/iw/partition_dialog_gui.py @@ -239,7 +239,7 @@ class PartitionEditor: usedev = request origformat = usedev.format - devicetree = self.anaconda.id.storage.devicetree + devicetree = self.anaconda.storage.devicetree if self.fsoptionsDict.has_key("formatcb"): if self.fsoptionsDict["formatcb"].get_active(): @@ -337,7 +337,7 @@ class PartitionEditor: def __init__(self, anaconda, parent, origrequest, isNew = 0, restrictfs = None): self.anaconda = anaconda - self.storage = self.anaconda.id.storage + self.storage = self.anaconda.storage self.intf = self.anaconda.intf self.origrequest = origrequest self.isNew = isNew diff --git a/iw/partition_gui.py b/iw/partition_gui.py index 2e9be5ff6..588174135 100644 --- a/iw/partition_gui.py +++ b/iw/partition_gui.py @@ -1677,14 +1677,14 @@ class PartitionWindow(InstallWindow): for action in actions: # XXX we should handle exceptions here - self.anaconda.id.storage.devicetree.registerAction(action) + self.anaconda.storage.devicetree.registerAction(action) if self.refresh(justRedraw=not actions): # autopart failed -- cancel the actions and try to get # back to previous state actions.reverse() for action in actions: - self.anaconda.id.storage.devicetree.cancelAction(action) + self.anaconda.storage.devicetree.cancelAction(action) # FIXME: proper action/device management would be better if not isNew: @@ -1793,7 +1793,7 @@ class PartitionWindow(InstallWindow): def getScreen(self, anaconda): self.anaconda = anaconda - self.storage = anaconda.id.storage + self.storage = anaconda.storage self.intf = anaconda.intf self.checkmark_pixbuf = gui.getPixbuf("checkMark.png") self.lock_pixbuf = gui.getPixbuf("gnome-lock.png") diff --git a/iw/task_gui.py b/iw/task_gui.py index a02adcb8c..b5aa73bb2 100644 --- a/iw/task_gui.py +++ b/iw/task_gui.py @@ -275,7 +275,7 @@ class RepoEditor: def _applyMedia(self, repo): # FIXME works only if storage has detected format of cdrom drive ayum = self.anaconda.backend.ayum - cdr = scanForMedia(ayum.tree, self.anaconda.id.storage) + cdr = scanForMedia(ayum.tree, self.anaconda.storage) if not cdr: self.intf.messageWindow(_("No Media Found"), _("No installation media was found. " @@ -421,7 +421,7 @@ class RepoMethodstrEditor(RepoEditor): return repourl def _applyMedia(self): - cdr = scanForMedia(self.anaconda.backend.ayum.tree, self.anaconda.id.storage) + cdr = scanForMedia(self.anaconda.backend.ayum.tree, self.anaconda.storage) if not cdr: self.intf.messageWindow(_("No Media Found"), _("No installation media was found. " diff --git a/iw/upgrade_bootloader_gui.py b/iw/upgrade_bootloader_gui.py index 72e0ec297..5c96f4192 100644 --- a/iw/upgrade_bootloader_gui.py +++ b/iw/upgrade_bootloader_gui.py @@ -118,7 +118,7 @@ class UpgradeBootloaderWindow (InstallWindow): newToLibata = self._newToLibata(anaconda.rootPath) (self.type, self.bootDev) = \ - checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.id.storage) + checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.storage) self.update_radio = gtk.RadioButton(None, _("_Update boot loader configuration")) updatestr = _("This will update your current boot loader.") diff --git a/iw/upgrade_migratefs_gui.py b/iw/upgrade_migratefs_gui.py index 622c21cb4..dd3de5c39 100644 --- a/iw/upgrade_migratefs_gui.py +++ b/iw/upgrade_migratefs_gui.py @@ -60,8 +60,8 @@ class UpgradeMigrateFSWindow (InstallWindow): return None def getScreen (self, anaconda): - self.devicetree = anaconda.id.storage.devicetree - self.migent = anaconda.id.storage.migratableDevices + self.devicetree = anaconda.storage.devicetree + self.migent = anaconda.storage.migratableDevices box = gtk.VBox (False, 5) box.set_border_width (5) diff --git a/iw/upgrade_swap_gui.py b/iw/upgrade_swap_gui.py index 53a2357e1..0edba095e 100644 --- a/iw/upgrade_swap_gui.py +++ b/iw/upgrade_swap_gui.py @@ -78,7 +78,7 @@ class UpgradeSwapWindow (InstallWindow): def getScreen (self, anaconda): self.neededSwap = 0 - self.storage = anaconda.id.storage + self.storage = anaconda.storage self.intf = anaconda.intf self.dispatch = anaconda.dispatch diff --git a/kickstart.py b/kickstart.py index e510bdd01..538caf9d2 100644 --- a/kickstart.py +++ b/kickstart.py @@ -187,15 +187,15 @@ class AutoPart(commands.autopart.F12_AutoPart): def execute(self, anaconda): # sets up default autopartitioning. use clearpart separately # if you want it - anaconda.instClass.setDefaultPartitioning(anaconda.id.storage, anaconda.platform) - anaconda.id.storage.doAutoPart = True + anaconda.instClass.setDefaultPartitioning(anaconda.storage, anaconda.platform) + anaconda.storage.doAutoPart = True if self.encrypted: - anaconda.id.storage.encryptedAutoPart = True - anaconda.id.storage.encryptionPassphrase = self.passphrase - anaconda.id.storage.autoPartEscrowCert = \ + anaconda.storage.encryptedAutoPart = True + anaconda.storage.encryptionPassphrase = self.passphrase + anaconda.storage.autoPartEscrowCert = \ getEscrowCertificate(anaconda, self.escrowcert) - anaconda.id.storage.autoPartAddBackupPassphrase = \ + anaconda.storage.autoPartAddBackupPassphrase = \ self.backuppassphrase anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) @@ -245,11 +245,11 @@ class Bootloader(commands.bootloader.F12_Bootloader): # add unpartitioned devices that will get partitioned into # bootloader.drivelist - disks = anaconda.id.storage.disks - partitioned = anaconda.id.storage.partitioned + disks = anaconda.storage.disks + partitioned = anaconda.storage.partitioned for disk in [d for d in disks if not d.partitioned]: - if shouldClear(disk, anaconda.id.storage.clearPartType, - anaconda.id.storage.clearPartDisks): + if shouldClear(disk, anaconda.storage.clearPartType, + anaconda.storage.clearPartDisks): # add newly partitioned disks to the drivelist anaconda.id.bootloader.drivelist.append(disk.name) elif disk.name in anaconda.id.bootloader.drivelist: @@ -294,13 +294,13 @@ class ClearPart(commands.clearpart.FC3_ClearPart): return retval def execute(self, anaconda): - anaconda.id.storage.clearPartType = self.type - anaconda.id.storage.clearPartDisks = self.drives + anaconda.storage.clearPartType = self.type + anaconda.storage.clearPartDisks = self.drives if self.initAll: - anaconda.id.storage.reinitializeDisks = self.initAll + anaconda.storage.reinitializeDisks = self.initAll - clearPartitions(anaconda.id.storage) - anaconda.id.ksdata.skipSteps.append("cleardiskssel") + clearPartitions(anaconda.storage) + anaconda.ksdata.skipSteps.append("cleardisksel") class Fcoe(commands.fcoe.F13_Fcoe): def parse(self, args): @@ -356,9 +356,9 @@ class IgnoreDisk(commands.ignoredisk.F8_IgnoreDisk): return retval def execute(self, anaconda): - anaconda.id.storage.ignoredDisks = self.ignoredisk - anaconda.id.storage.exclusiveDisks = self.onlyuse - anaconda.id.ksdata.skipSteps.extend(["filter", "filtertype"]) + anaconda.storage.ignoredDisks = self.ignoredisk + anaconda.storage.exclusiveDisks = self.onlyuse + anaconda.ksdata.skipSteps.extend(["filter", "filtertype"]) class Iscsi(commands.iscsi.F10_Iscsi): def parse(self, args): @@ -394,7 +394,7 @@ class Lang(commands.lang.FC3_Lang): class LogVolData(commands.logvol.F12_LogVolData): def execute(self, anaconda): - storage = anaconda.id.storage + storage = anaconda.storage devicetree = storage.devicetree storage.doAutoPart = False @@ -593,7 +593,7 @@ class DmRaid(commands.dmraid.FC6_DmRaid): class PartitionData(commands.partition.F12_PartData): def execute(self, anaconda): - storage = anaconda.id.storage + storage = anaconda.storage devicetree = storage.devicetree kwargs = {} @@ -776,7 +776,7 @@ class RaidData(commands.raid.F12_RaidData): raidmems = [] devicename = "md%d" % self.device - storage = anaconda.id.storage + storage = anaconda.storage devicetree = storage.devicetree kwargs = {} @@ -943,7 +943,7 @@ class VolGroupData(commands.volgroup.FC3_VolGroupData): def execute(self, anaconda): pvs = [] - storage = anaconda.id.storage + storage = anaconda.storage devicetree = storage.devicetree storage.doAutoPart = False @@ -989,7 +989,7 @@ class XConfig(commands.xconfig.F10_XConfig): class ZeroMbr(commands.zerombr.FC3_ZeroMbr): def execute(self, anaconda): - anaconda.id.storage.zeroMbr = 1 + anaconda.storage.zeroMbr = 1 class ZFCP(commands.zfcp.FC3_ZFCP): def parse(self, args): diff --git a/livecd.py b/livecd.py index ca78199de..9058a494e 100644 --- a/livecd.py +++ b/livecd.py @@ -162,7 +162,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): def postAction(self, anaconda): self._unmountNonFstabDirs(anaconda) try: - anaconda.id.storage.umountFilesystems(swapoff = False) + anaconda.storage.umountFilesystems(swapoff = False) os.rmdir(anaconda.rootPath) except Exception, e: log.error("Unable to unmount filesystems: %s" % e) @@ -171,7 +171,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): if anaconda.dir == DISPATCH_BACK: self._unmountNonFstabDirs(anaconda) return - anaconda.id.storage.umountFilesystems(swapoff = False) + anaconda.storage.umountFilesystems(swapoff = False) def doInstall(self, anaconda): log.info("Preparing to install packages") @@ -183,7 +183,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): osimg = self._getLiveBlockDevice() # the real image osfd = os.open(osimg, os.O_RDONLY) - rootDevice = anaconda.id.storage.rootDevice + rootDevice = anaconda.storage.rootDevice rootDevice.setup() rootfd = os.open(rootDevice.path, os.O_WRONLY) @@ -233,10 +233,10 @@ class LiveCDCopyBackend(backend.AnacondaBackend): self._resizeRootfs(anaconda, wait) # remount filesystems - anaconda.id.storage.mountFilesystems() + anaconda.storage.mountFilesystems() # restore the label of / to what we think it is - rootDevice = anaconda.id.storage.rootDevice + rootDevice = anaconda.storage.rootDevice rootDevice.setup() # ensure we have a random UUID on the rootfs # FIXME: this should be abstracted per filesystem type @@ -262,8 +262,8 @@ class LiveCDCopyBackend(backend.AnacondaBackend): # now create a tree so that we know what's mounted under where fsdict = {"/": []} - for mount in sorted(anaconda.id.storage.mountpoints.keys()): - entry = anaconda.id.storage.mountpoints[mount] + for mount in sorted(anaconda.storage.mountpoints.keys()): + entry = anaconda.storage.mountpoints[mount] tocopy = entry.format.mountpoint if tocopy.startswith("/mnt") or tocopy == "swap": continue @@ -282,7 +282,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): continue copied.append(tocopy) copied.extend(map(lambda x: x.format.mountpoint, fsdict[tocopy])) - entry = anaconda.id.storage.mountpoints[tocopy] + entry = anaconda.storage.mountpoints[tocopy] # FIXME: all calls to wait.refresh() are kind of a hack... we # should do better about not doing blocking things in the @@ -326,7 +326,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): def _resizeRootfs(self, anaconda, win = None): log.info("going to do resize") - rootDevice = anaconda.id.storage.rootDevice + rootDevice = anaconda.storage.rootDevice # FIXME: we'd like to have progress here to give an idea of # how long it will take. or at least, to give an indefinite @@ -367,9 +367,9 @@ class LiveCDCopyBackend(backend.AnacondaBackend): packages.rpmSetupGraphicalSystem(anaconda) # now write out the "real" fstab and mtab - anaconda.id.storage.write(anaconda.rootPath) + anaconda.storage.write(anaconda.rootPath) f = open(anaconda.rootPath + "/etc/mtab", "w+") - f.write(anaconda.id.storage.mtab) + f.write(anaconda.storage.mtab) f.close() # copy over the modprobe.conf @@ -398,7 +398,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): # FIXME: really, this should be in the general sanity checking, but # trying to weave that in is a little tricky at present. ossize = self._getLiveSizeMB() - slash = anaconda.id.storage.rootDevice + slash = anaconda.storage.rootDevice if slash.size < ossize: rc = anaconda.intf.messageWindow(_("Error"), _("The root filesystem you created is " diff --git a/network.py b/network.py index 6d3f07d8d..a3fb8ee9e 100644 --- a/network.py +++ b/network.py @@ -589,10 +589,10 @@ class Network: # installation when / is on a network backed device. if anaconda is not None: import storage - rootdev = anaconda.id.storage.rootDevice + rootdev = anaconda.storage.rootDevice # FIXME: use d.host_address to only add "NM_CONTROLLED=no" # for interfaces actually used enroute to the device - for d in anaconda.id.storage.devices: + for d in anaconda.storage.devices: if isinstance(d, storage.devices.NetworkStorageDevice) and\ (rootdev.dependsOn(d) or d.nic == device): f.write("NM_CONTROLLED=no\n") diff --git a/packages.py b/packages.py index eda06975b..3d5cd1eee 100644 --- a/packages.py +++ b/packages.py @@ -84,20 +84,20 @@ def turnOnFilesystems(anaconda): if anaconda.dir == DISPATCH_BACK: if not anaconda.upgrade: log.info("unmounting filesystems") - anaconda.id.storage.umountFilesystems() + anaconda.storage.umountFilesystems() return DISPATCH_NOOP if not anaconda.upgrade: - if not anaconda.id.storage.fsset.active: + if not anaconda.storage.fsset.active: # turn off any swaps that we didn't turn on # needed for live installs iutil.execWithRedirect("swapoff", ["-a"], stdout = "/dev/tty5", stderr="/dev/tty5") - anaconda.id.storage.devicetree.teardownAll() + anaconda.storage.devicetree.teardownAll() upgrade_migrate = False if anaconda.upgrade: - for d in anaconda.id.storage.migratableDevices: + for d in anaconda.storage.migratableDevices: if d.format.migrate: upgrade_migrate = True @@ -106,7 +106,7 @@ def turnOnFilesystems(anaconda): details = None try: - anaconda.id.storage.doIt() + anaconda.storage.doIt() except DeviceResizeError as (msg, device): # XXX does this make any sense? do we support resize of # devices other than partitions? @@ -166,16 +166,16 @@ def turnOnFilesystems(anaconda): sys.exit(1) if not anaconda.upgrade: - anaconda.id.storage.turnOnSwap() - anaconda.id.storage.mountFilesystems(raiseErrors=False, - readOnly=False, - skipRoot=anaconda.backend.skipFormatRoot) + anaconda.storage.turnOnSwap() + anaconda.storage.mountFilesystems(raiseErrors=False, + readOnly=False, + skipRoot=anaconda.backend.skipFormatRoot) else: if upgrade_migrate: # we should write out a new fstab with the migrated fstype shutil.copyfile("%s/etc/fstab" % anaconda.rootPath, "%s/etc/fstab.anaconda" % anaconda.rootPath) - anaconda.id.storage.fsset.write(anaconda.rootPath) + anaconda.storage.fsset.write(anaconda.rootPath) # and make sure /dev is mounted so we can read the bootloader bindMountDevDirectory(anaconda.rootPath) @@ -233,7 +233,7 @@ def setFileCons(anaconda): "/etc/shadow", "/etc/shadow-", "/etc/gshadow"] + \ glob.glob('/etc/dhclient-*.conf') - vgs = ["/dev/%s" % vg.name for vg in anaconda.id.storage.vgs] + vgs = ["/dev/%s" % vg.name for vg in anaconda.storage.vgs] # ugh, this is ugly for dir in ["/etc/sysconfig/network-scripts", "/var/lib/rpm", "/etc/lvm", "/dev/mapper", "/etc/iscsi", "/var/lib/iscsi", "/root", "/var/log", "/etc/modprobe.d", "/etc/sysconfig" ] + vgs: diff --git a/partIntfHelpers.py b/partIntfHelpers.py index 95af9fc7a..3aaba7122 100644 --- a/partIntfHelpers.py +++ b/partIntfHelpers.py @@ -210,7 +210,7 @@ def doClearPartitionedDevice(intf, storage, device, confirm=1, quiet=0): def checkForSwapNoMatch(anaconda): """Check for any partitions of type 0x82 which don't have a swap fs.""" - for device in anaconda.id.storage.partitions: + for device in anaconda.storage.partitions: if not device.exists: # this is only for existing partitions continue @@ -228,7 +228,7 @@ def checkForSwapNoMatch(anaconda): custom_icon="question") if rc == 1: format = getFormat("swap", device=device.path) - anaconda.id.storage.formatDevice(device, format) + anaconda.storage.formatDevice(device, format) return diff --git a/platform.py b/platform.py index f3154d4c0..f1ff194dd 100644 --- a/platform.py +++ b/platform.py @@ -57,7 +57,7 @@ class Platform(object): def _mntDict(self): """Return a dictionary mapping mount points to devices.""" ret = {} - for device in [d for d in self.anaconda.id.storage.devices if d.format.mountable]: + for device in [d for d in self.anaconda.storage.devices if d.format.mountable]: ret[device.format.mountpoint] = device return ret @@ -135,8 +135,8 @@ class Platform(object): errors.append(_("Bootable partitions cannot be on an encrypted block device")) else: # Handle encrypted boot on more complicated devices. - for dev in map(lambda d: d.type == "luks/dm-crypt", self.anaconda.id.storage.devices): - if req in self.anaconda.id.storage.deviceDeps(dev): + for dev in map(lambda d: d.type == "luks/dm-crypt", self.anaconda.storage.devices): + if req in self.anaconda.storage.deviceDeps(dev): errors.append(_("Bootable partitions cannot be on an encrypted block device")) return errors @@ -245,7 +245,7 @@ class EFI(Platform): # Only add the EFI partition to the default set if there's not already # one on the system. if len(filter(lambda dev: dev.format.type == "efi" and self.validBootPartSize(dev.size), - self.anaconda.id.storage.partitions)) == 0: + self.anaconda.storage.partitions)) == 0: ret.append(PartSpec(mountpoint="/boot/efi", fstype="efi", size=20, maxSize=200, grow=True, weight=self.weight(fstype="efi"))) @@ -312,7 +312,7 @@ class IPSeriesPPC(PPC): bootDev = None # We want the first PReP partition. - for device in self.anaconda.id.storage.partitions: + for device in self.anaconda.storage.partitions: if device.format.type == "prepboot": bootDev = device break @@ -349,9 +349,9 @@ class IPSeriesPPC(PPC): errors.append(_("The boot partition must be within the first 4MB of the disk.")) try: - req = self.anaconda.id.storage.mountpoints["/boot"] + req = self.anaconda.storage.mountpoints["/boot"] except KeyError: - req = self.anaconda.id.storage.rootDevice + req = self.anaconda.storage.rootDevice return errors + self.checkBootRequest(req) else: @@ -379,7 +379,7 @@ class NewWorldPPC(PPC): def bootDevice(self): bootDev = None - for part in self.anaconda.id.storage.partitions: + for part in self.anaconda.storage.partitions: if part.format.type == "appleboot" and self.validBootPartSize(part.size): bootDev = part # if we're only picking one, it might as well be the first @@ -399,7 +399,7 @@ class NewWorldPPC(PPC): ret["mbr"] = (bl.drivelist[0], N_("Master Boot Record (MBR)")) else: ret["boot"] = (bootDev.name, N_("Apple Bootstrap")) - for (n, device) in enumerate(self.anaconda.id.storage.partitions): + for (n, device) in enumerate(self.anaconda.storage.partitions): if device.format.type == "appleboot" and device.path != bootDev.path: ret["boot%d" % n] = (device.path, N_("Apple Bootstrap")) @@ -421,9 +421,9 @@ class NewWorldPPC(PPC): # need to make sure that whatever /boot is on also meets these criteria. if req == self.bootDevice(): try: - req = self.anaconda.id.storage.mountpoints["/boot"] + req = self.anaconda.storage.mountpoints["/boot"] except KeyError: - req = self.anaconda.id.storage.rootDevice + req = self.anaconda.storage.rootDevice return errors + self.checkBootRequest(req) else: diff --git a/rescue.py b/rescue.py index f90d6bedc..52b66c0f1 100644 --- a/rescue.py +++ b/rescue.py @@ -366,7 +366,7 @@ def runRescue(anaconda): # now turn on swap if not readOnly: try: - anaconda.id.storage.turnOnSwap() + anaconda.storage.turnOnSwap() except: log.error("Error enabling swap") @@ -455,7 +455,7 @@ def runRescue(anaconda): msgStr = "" if rootmounted and not readOnly: - makeMtab(anaconda.rootPath, anaconda.id.storage) + makeMtab(anaconda.rootPath, anaconda.storage) try: makeResolvConf(anaconda.rootPath) except Exception, e: diff --git a/storage/__init__.py b/storage/__init__.py index 14ab49d7f..70eda0dba 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -65,7 +65,7 @@ import logging log = logging.getLogger("storage") def storageInitialize(anaconda): - storage = anaconda.id.storage + storage = anaconda.storage storage.shutdown() @@ -123,7 +123,7 @@ def storageComplete(anaconda): sys.exit(0) return DISPATCH_FORWARD - devs = anaconda.id.storage.devicetree.getDevicesByType("luks/dm-crypt") + devs = anaconda.storage.devicetree.getDevicesByType("luks/dm-crypt") existing_luks = False new_luks = False for dev in devs: @@ -132,13 +132,13 @@ def storageComplete(anaconda): else: new_luks = True - if (anaconda.id.storage.encryptedAutoPart or new_luks) and \ - not anaconda.id.storage.encryptionPassphrase: + if (anaconda.storage.encryptedAutoPart or new_luks) and \ + not anaconda.storage.encryptionPassphrase: while True: (passphrase, retrofit) = anaconda.intf.getLuksPassphrase(preexist=existing_luks) if passphrase: - anaconda.id.storage.encryptionPassphrase = passphrase - anaconda.id.storage.encryptionRetrofit = retrofit + anaconda.storage.encryptionPassphrase = passphrase + anaconda.storage.encryptionRetrofit = retrofit break else: rc = anaconda.intf.messageWindow(_("Encrypt device?"), @@ -153,14 +153,14 @@ def storageComplete(anaconda): default=0) if rc == 1: log.info("user elected to not encrypt any devices.") - undoEncryption(anaconda.id.storage) - anaconda.id.storage.encryptedAutoPart = False + undoEncryption(anaconda.storage) + anaconda.storage.encryptedAutoPart = False break - if anaconda.id.storage.encryptionPassphrase: - for dev in anaconda.id.storage.devices: + if anaconda.storage.encryptionPassphrase: + for dev in anaconda.storage.devices: if dev.format.type == "luks" and not dev.format.exists: - dev.format.passphrase = anaconda.id.storage.encryptionPassphrase + dev.format.passphrase = anaconda.storage.encryptionPassphrase if anaconda.ksdata: return @@ -176,7 +176,7 @@ def storageComplete(anaconda): default = 0) # Make sure that all is down, even the disks that we setup after popluate. - anaconda.id.storage.devicetree.teardownAll() + anaconda.storage.devicetree.teardownAll() if rc == 0: return DISPATCH_BACK @@ -184,7 +184,7 @@ def storageComplete(anaconda): def writeEscrowPackets(anaconda): escrowDevices = filter(lambda d: d.format.type == "luks" and \ d.format.escrow_cert, - anaconda.id.storage.devices) + anaconda.storage.devices) if not escrowDevices: return @@ -1249,7 +1249,7 @@ def findExistingRootDevices(anaconda, upgradeany=False): iutil.mkdirChain(anaconda.rootPath) roots = [] - for device in anaconda.id.storage.devicetree.leaves: + for device in anaconda.storage.devicetree.leaves: if not device.format.linuxNative or not device.format.mountable: continue @@ -1292,7 +1292,7 @@ def mountExistingSystem(anaconda, rootEnt, """ Mount filesystems specified in rootDevice's /etc/fstab file. """ rootDevice = rootEnt[0] rootPath = anaconda.rootPath - fsset = anaconda.id.storage.fsset + fsset = anaconda.storage.fsset if readOnly: readOnly = "ro" else: @@ -1336,7 +1336,7 @@ def mountExistingSystem(anaconda, rootEnt, "Linux installation, let the file systems be " "checked and shut down cleanly to upgrade.\n" "%s") % "\n".join(dirtyDevs)) - anaconda.id.storage.devicetree.teardownAll() + anaconda.storage.devicetree.teardownAll() sys.exit(0) elif warnDirty and dirtyDevs: rc = messageWindow(_("Dirty File Systems"), diff --git a/storage/iscsi.py b/storage/iscsi.py index 68c2c9d53..a1c6198db 100644 --- a/storage/iscsi.py +++ b/storage/iscsi.py @@ -283,10 +283,10 @@ class iscsi(object): return # set iscsi nodes to autostart - root = anaconda.id.storage.rootDevice + root = anaconda.storage.rootDevice for node in self.nodes: autostart = True - disks = self.getNodeDisks(node, anaconda.id.storage) + disks = self.getNodeDisks(node, anaconda.storage) for disk in disks: # nodes used for root get started by the initrd if root.dependsOn(disk): diff --git a/storage/partitioning.py b/storage/partitioning.py index 36f26a06c..87154ee32 100644 --- a/storage/partitioning.py +++ b/storage/partitioning.py @@ -44,9 +44,9 @@ def _createFreeSpacePartitions(anaconda): # get a list of disks that have at least one free space region of at # least 100MB disks = [] - for disk in anaconda.id.storage.partitioned: - if anaconda.id.storage.clearPartDisks and \ - (disk.name not in anaconda.id.storage.clearPartDisks): + for disk in anaconda.storage.partitioned: + if anaconda.storage.clearPartDisks and \ + (disk.name not in anaconda.storage.clearPartDisks): continue part = disk.format.firstPartition @@ -64,19 +64,19 @@ def _createFreeSpacePartitions(anaconda): # create a separate pv partition for each disk with free space devs = [] for disk in disks: - if anaconda.id.storage.encryptedAutoPart: + if anaconda.storage.encryptedAutoPart: fmt_type = "luks" - fmt_args = {"escrow_cert": anaconda.id.storage.autoPartEscrowCert, - "add_backup_passphrase": anaconda.id.storage.autoPartAddBackupPassphrase} + fmt_args = {"escrow_cert": anaconda.storage.autoPartEscrowCert, + "add_backup_passphrase": anaconda.storage.autoPartAddBackupPassphrase} else: fmt_type = "lvmpv" fmt_args = {} - part = anaconda.id.storage.newPartition(fmt_type=fmt_type, + part = anaconda.storage.newPartition(fmt_type=fmt_type, fmt_args=fmt_args, size=1, grow=True, disks=[disk]) - anaconda.id.storage.createDevice(part) + anaconda.storage.createDevice(part) devs.append(part) return (disks, devs) @@ -88,33 +88,33 @@ def _schedulePartitions(anaconda, disks): # # First pass is for partitions only. We'll do LVs later. # - for request in anaconda.id.storage.autoPartitionRequests: + for request in anaconda.storage.autoPartitionRequests: if request.asVol: continue if request.fstype is None: - request.fstype = anaconda.id.storage.defaultFSType + request.fstype = anaconda.storage.defaultFSType # This is a little unfortunate but let the backend dictate the rootfstype # so that things like live installs can do the right thing if request.mountpoint == "/" and anaconda.backend.rootFsType != None: request.fstype = anaconda.backend.rootFsType - dev = anaconda.id.storage.newPartition(fmt_type=request.fstype, - size=request.size, - grow=request.grow, - maxsize=request.maxSize, - mountpoint=request.mountpoint, - disks=disks, - weight=request.weight) + dev = anaconda.storage.newPartition(fmt_type=request.fstype, + size=request.size, + grow=request.grow, + maxsize=request.maxSize, + mountpoint=request.mountpoint, + disks=disks, + weight=request.weight) # schedule the device for creation - anaconda.id.storage.createDevice(dev) + anaconda.storage.createDevice(dev) # make sure preexisting broken lvm/raid configs get out of the way return def _scheduleLVs(anaconda, devs): - if anaconda.id.storage.encryptedAutoPart: + if anaconda.storage.encryptedAutoPart: pvs = [] for dev in devs: pv = LUKSDevice("luks-%s" % dev.name, @@ -122,13 +122,13 @@ def _scheduleLVs(anaconda, devs): size=dev.size, parents=dev) pvs.append(pv) - anaconda.id.storage.createDevice(pv) + anaconda.storage.createDevice(pv) else: pvs = devs # create a vg containing all of the autopart pvs - vg = anaconda.id.storage.newVG(pvs=pvs) - anaconda.id.storage.createDevice(vg) + vg = anaconda.storage.newVG(pvs=pvs) + anaconda.storage.createDevice(vg) initialVGSize = vg.size @@ -137,7 +137,7 @@ def _scheduleLVs(anaconda, devs): # schedule them for creation. # # Second pass, for LVs only. - for request in anaconda.id.storage.autoPartitionRequests: + for request in anaconda.storage.autoPartitionRequests: if not request.asVol: continue @@ -145,7 +145,7 @@ def _scheduleLVs(anaconda, devs): continue if request.fstype is None: - request.fstype = anaconda.id.storage.defaultFSType + request.fstype = anaconda.storage.defaultFSType # This is a little unfortunate but let the backend dictate the rootfstype # so that things like live installs can do the right thing @@ -153,37 +153,37 @@ def _scheduleLVs(anaconda, devs): request.fstype = anaconda.backend.rootFsType # FIXME: move this to a function and handle exceptions - dev = anaconda.id.storage.newLV(vg=vg, - fmt_type=request.fstype, - mountpoint=request.mountpoint, - grow=request.grow, - maxsize=request.maxSize, - size=request.size) + dev = anaconda.storage.newLV(vg=vg, + fmt_type=request.fstype, + mountpoint=request.mountpoint, + grow=request.grow, + maxsize=request.maxSize, + size=request.size) # schedule the device for creation - anaconda.id.storage.createDevice(dev) + anaconda.storage.createDevice(dev) def doAutoPartition(anaconda): log.debug("doAutoPartition(%s)" % anaconda) - log.debug("doAutoPart: %s" % anaconda.id.storage.doAutoPart) - log.debug("clearPartType: %s" % anaconda.id.storage.clearPartType) - log.debug("clearPartDisks: %s" % anaconda.id.storage.clearPartDisks) - log.debug("autoPartitionRequests: %s" % anaconda.id.storage.autoPartitionRequests) - log.debug("storage.disks: %s" % [d.name for d in anaconda.id.storage.disks]) - log.debug("storage.partitioned: %s" % [d.name for d in anaconda.id.storage.partitioned]) - log.debug("all names: %s" % [d.name for d in anaconda.id.storage.devices]) + log.debug("doAutoPart: %s" % anaconda.storage.doAutoPart) + log.debug("clearPartType: %s" % anaconda.storage.clearPartType) + log.debug("clearPartDisks: %s" % anaconda.storage.clearPartDisks) + log.debug("autoPartitionRequests: %s" % anaconda.storage.autoPartitionRequests) + log.debug("storage.disks: %s" % [d.name for d in anaconda.storage.disks]) + log.debug("storage.partitioned: %s" % [d.name for d in anaconda.storage.partitioned]) + log.debug("all names: %s" % [d.name for d in anaconda.storage.devices]) if anaconda.dir == DISPATCH_BACK: - anaconda.id.storage.reset() + anaconda.storage.reset() return disks = [] devs = [] - if anaconda.id.storage.doAutoPart: - clearPartitions(anaconda.id.storage) + if anaconda.storage.doAutoPart: + clearPartitions(anaconda.storage) - if anaconda.id.storage.doAutoPart: + if anaconda.storage.doAutoPart: (disks, devs) = _createFreeSpacePartitions(anaconda) if disks == []: @@ -200,7 +200,7 @@ def doAutoPartition(anaconda): if anaconda.ksdata: sys.exit(0) - anaconda.id.storage.reset() + anaconda.storage.reset() return DISPATCH_BACK _schedulePartitions(anaconda, disks) @@ -210,14 +210,14 @@ def doAutoPartition(anaconda): # run the autopart function to allocate and grow partitions try: - doPartitioning(anaconda.id.storage, - exclusiveDisks=anaconda.id.storage.clearPartDisks) + doPartitioning(anaconda.storage, + exclusiveDisks=anaconda.storage.clearPartDisks) - if anaconda.id.storage.doAutoPart: + if anaconda.storage.doAutoPart: _scheduleLVs(anaconda, devs) # grow LVs - growLVM(anaconda.id.storage) + growLVM(anaconda.storage) except PartitioningWarning as msg: if not anaconda.ksdata: anaconda.intf.messageWindow(_("Warnings During Automatic " @@ -229,7 +229,7 @@ def doAutoPartition(anaconda): log.warning(msg) except PartitioningError as msg: # restore drives to original state - anaconda.id.storage.reset() + anaconda.storage.reset() if not anaconda.ksdata: extra = "" anaconda.dispatch.skipStep("partition", skip = 0) @@ -248,7 +248,7 @@ def doAutoPartition(anaconda): # sanity check the collection of devices log.warning("not sanity checking storage config because I don't know how yet") # now do a full check of the requests - (errors, warnings) = anaconda.id.storage.sanityCheck() + (errors, warnings) = anaconda.storage.sanityCheck() if warnings: for warning in warnings: log.warning(warning) @@ -274,7 +274,7 @@ def doAutoPartition(anaconda): anaconda.intf.messageWindow(_("Unrecoverable Error"), _("The system will now reboot.")) sys.exit(0) - anaconda.id.storage.reset() + anaconda.storage.reset() return DISPATCH_BACK def shouldClear(device, clearPartType, clearPartDisks=None): diff --git a/textw/partition_text.py b/textw/partition_text.py index e5db580f1..6d1e61b19 100644 --- a/textw/partition_text.py +++ b/textw/partition_text.py @@ -67,10 +67,10 @@ class PartitionTypeWindow: for (txt, val) in opts: typebox.append(txt, val) - if anaconda.id.storage.clearPartType is None: + if anaconda.storage.clearPartType is None: preselection = CLEARPART_TYPE_LINUX else: - preselection = anaconda.id.storage.clearPartType + preselection = anaconda.storage.clearPartType typebox.setCurrent(preselection) g.add(typebox, 0, 1, (0, 1, 0, 0)) @@ -95,8 +95,8 @@ class PartitionTypeWindow: screen.pushHelpLine (_(",<+>,<-> selection | Add drive | next screen")) # restore the drive list each time - disks = anaconda.id.storage.partitioned - cleardrives = anaconda.id.storage.clearPartDisks + disks = anaconda.storage.partitioned + cleardrives = anaconda.storage.clearPartDisks for disk in disks: model = disk.model @@ -129,14 +129,14 @@ class PartitionTypeWindow: if rc == "F2": if self.addDriveDialog(screen) != INSTALL_BACK: - anaconda.id.storage.reset() + anaconda.storage.reset() anaconda.id.bootloader.updateDriveList() continue if res == TEXT_BACK_CHECK: return INSTALL_BACK - if anaconda.id.storage.checkNoDisks(): + if anaconda.storage.checkNoDisks(): continue if len(sel) < 1: @@ -144,9 +144,9 @@ class PartitionTypeWindow: continue anaconda.dispatch.skipStep("autopartitionexecute", skip = 0) - anaconda.id.storage.doAutoPart = True - anaconda.id.storage.clearPartType = partmethod_ans - anaconda.id.storage.clearPartDisks = sel + anaconda.storage.doAutoPart = True + anaconda.storage.clearPartType = partmethod_ans + anaconda.storage.clearPartDisks = sel break # ask to review autopartition layout - but only if it's not custom partitioning @@ -212,7 +212,7 @@ class PartitionTypeWindow: wwpn = entries[1].strip() fcplun = entries[2].strip() try: - self.anaconda.id.storage.zfcp.addFCP(devnum, wwpn, fcplun) + self.anaconda.storage.zfcp.addFCP(devnum, wwpn, fcplun) except ValueError, e: log.warn(str(e)) # alternatively popup error dialog instead @@ -262,8 +262,8 @@ class PartitionTypeWindow: nic = interfaceList.current() dcb = dcbCheckbox.selected() - self.anaconda.id.storage.fcoe.addSan(nic=nic, dcb=dcb, - intf=self.anaconda.intf) + self.anaconda.storage.fcoe.addSan(nic=nic, dcb=dcb, + intf=self.anaconda.intf) screen.popWindow() return INSTALL_OK @@ -313,9 +313,9 @@ class PartitionTypeWindow: raise ValueError, msg iname = entries[1].strip() - if not self.anaconda.id.storage.iscsi.initiatorSet: - self.anaconda.id.storage.iscsi.initiator = iname - self.anaconda.id.storage.iscsi.addTarget(ip, port, user, pw, - user_in, pw_in) + if not self.anaconda.storage.iscsi.initiatorSet: + self.anaconda.storage.iscsi.initiator = iname + self.anaconda.storage.iscsi.addTarget(ip, port, user, pw, + user_in, pw_in) return INSTALL_OK diff --git a/textw/upgrade_bootloader_text.py b/textw/upgrade_bootloader_text.py index 89e5b438e..3f2d1273e 100644 --- a/textw/upgrade_bootloader_text.py +++ b/textw/upgrade_bootloader_text.py @@ -87,7 +87,7 @@ class UpgradeBootloaderWindow: newToLibata = self._ideToLibata(anaconda.rootPath) (self.type, self.bootDev) = \ - checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.id.storage) + checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.storage) blradio = RadioGroup() diff --git a/textw/upgrade_text.py b/textw/upgrade_text.py index a7435388d..6d7bfe72e 100644 --- a/textw/upgrade_text.py +++ b/textw/upgrade_text.py @@ -37,7 +37,7 @@ seenExamineScreen = False class UpgradeMigrateFSWindow: def __call__ (self, screen, anaconda): - migent = anaconda.id.storage.migratableDevices + migent = anaconda.storage.migratableDevices g = GridFormHelp(screen, _("Migrate File Systems"), "upmigfs", 1, 4) @@ -93,7 +93,7 @@ class UpgradeMigrateFSWindow: except Exception, e: log.info("failed to get new filesystem type, defaulting to ext3: %s" %(e,)) newfs = getFormat("ext3") - anaconda.id.storage.migrateFormat(entry, newfs) + anaconda.storage.migrateFormat(entry, newfs) screen.popWindow() return INSTALL_OK @@ -195,7 +195,7 @@ class UpgradeSwapWindow: "and 2000 MB in size.")) else: screen.popWindow() - anaconda.id.storage.createSwapFile(dev, val) + anaconda.storage.createSwapFile(dev, val) anaconda.dispatch.skipStep("addswap", 1) return INSTALL_OK diff --git a/upgrade.py b/upgrade.py index 637e1d8a6..438407adb 100644 --- a/upgrade.py +++ b/upgrade.py @@ -102,7 +102,7 @@ def bindMountDevDirectory(instPath): # returns None if no filesystem exist to migrate def upgradeMigrateFind(anaconda): - migents = anaconda.id.storage.migratableDevices + migents = anaconda.storage.migratableDevices if not migents or len(migents) < 1: anaconda.dispatch.skipStep("upgrademigratefs") else: @@ -140,7 +140,7 @@ def upgradeSwapSuggestion(anaconda): fsList = [] - for device in anaconda.id.storage.fsset.devices: + for device in anaconda.storage.fsset.devices: if not device.format: continue if device.format.mountable and device.format.linuxNative: @@ -238,8 +238,8 @@ def upgradeMountFilesystems(anaconda): anaconda.intf.messageWindow(_("Invalid Directories"), message) sys.exit(0) - anaconda.id.storage.turnOnSwap(upgrading=True) - anaconda.id.storage.mkDevRoot() + anaconda.storage.turnOnSwap(upgrading=True) + anaconda.storage.mkDevRoot() # Move /etc/rpm/platform out of the way. if os.path.exists(anaconda.rootPath + "/etc/rpm/platform"): diff --git a/yuminstall.py b/yuminstall.py index e34fa03ce..f3842ce22 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -358,7 +358,7 @@ class AnacondaYum(YumSorter): self._timestamp = f.readline().strip() f.close() - dev = self.anaconda.id.storage.devicetree.getDeviceByName(self.anaconda.mediaDevice) + dev = self.anaconda.storage.devicetree.getDeviceByName(self.anaconda.mediaDevice) dev.format.mountpoint = self.tree # If self.currentMedia is None, then there shouldn't be anything @@ -484,7 +484,7 @@ class AnacondaYum(YumSorter): # we should first check to see if there's a CD/DVD with packages # on it, and then default to the mirrorlist URL. The user can # always change the repo with the repo editor later. - cdr = scanForMedia(self.tree, self.anaconda.id.storage) + cdr = scanForMedia(self.tree, self.anaconda.storage) if cdr: self.mediagrabber = self.mediaHandler self.anaconda.mediaDevice = cdr @@ -818,7 +818,7 @@ class AnacondaYum(YumSorter): len(grab.mirrors))) if self.currentMedia: - dev = self.anaconda.id.storage.devicetree.getDeviceByName(self.anaconda.mediaDevice) + dev = self.anaconda.storage.devicetree.getDeviceByName(self.anaconda.mediaDevice) dev.format.mountpoint = self.tree unmountCD(dev, self.anaconda.intf.messageWindow) self.currentMedia = None @@ -885,7 +885,7 @@ class AnacondaYum(YumSorter): if len(mkeys) > 1: stage2img = "%s/images/install.img" % self.tree if self.anaconda.backend.mountInstallImage(self.anaconda, stage2img): - self.anaconda.id.storage.umountFilesystems() + self.anaconda.storage.umountFilesystems() return DISPATCH_BACK for i in mkeys: @@ -1392,7 +1392,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon # New installs only - upgrades will already have all this stuff. self.selectBestKernel(anaconda) map(self.selectPackage, anaconda.platform.packages) - self.selectFSPackages(anaconda.id.storage) + self.selectFSPackages(anaconda.storage) self.selectAnacondaNeeds() else: self.ayum.update() @@ -1451,7 +1451,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon (self.dlpkgs, self.totalSize, self.totalFiles) = self.ayum.getDownloadPkgs() if not anaconda.upgrade: - largePart = anaconda.id.storage.mountpoints.get("/usr", anaconda.id.storage.rootDevice) + largePart = anaconda.storage.mountpoints.get("/usr", anaconda.storage.rootDevice) if largePart and largePart.size < self.totalSize / 1024: rc = anaconda.intf.messageWindow(_("Error"), @@ -1527,7 +1527,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon # If there are any protected partitions we want to mount, create their # mount points now. - for protected in anaconda.id.storage.protectedDevices: + for protected in anaconda.storage.protectedDevices: if getattr(protected.format, "mountpoint", None): dirList.append(protected.format.mountpoint) @@ -1578,18 +1578,18 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon # write out the fstab if not anaconda.upgrade: - anaconda.id.storage.fsset.write(anaconda.rootPath) + anaconda.storage.fsset.write(anaconda.rootPath) if os.access("/etc/modprobe.d/anaconda.conf", os.R_OK): shutil.copyfile("/etc/modprobe.d/anaconda.conf", anaconda.rootPath + "/etc/modprobe.d/anaconda.conf") anaconda.network.write(instPath=anaconda.rootPath, anaconda=anaconda) - anaconda.id.storage.write(anaconda.rootPath) + anaconda.storage.write(anaconda.rootPath) if not anaconda.isHeadless: anaconda.keyboard.write(anaconda.rootPath) # make a /etc/mtab so mkinitrd can handle certain hw (usb) correctly f = open(anaconda.rootPath + "/etc/mtab", "w+") - f.write(anaconda.id.storage.mtab) + f.write(anaconda.storage.mtab) f.close() def checkSupportedUpgrade(self, anaconda): -- cgit