summaryrefslogtreecommitdiffstats
path: root/packages.py
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-02-27 13:41:19 -0600
committerDavid Lehman <dlehman@redhat.com>2009-02-27 13:41:19 -0600
commitcbc5a7a1e6e5a29ac2b26486c407af2bf66cb30b (patch)
tree9a56f1dd1ad4ae843dab1543937228b17dde0425 /packages.py
parent482c9c767d4eda51e1eedaaa85810b2e435b42d0 (diff)
downloadanaconda-cbc5a7a1e6e5a29ac2b26486c407af2bf66cb30b.tar.gz
anaconda-cbc5a7a1e6e5a29ac2b26486c407af2bf66cb30b.tar.xz
anaconda-cbc5a7a1e6e5a29ac2b26486c407af2bf66cb30b.zip
Remove doMigrateFilesystems, log storage to tty3.
Also let exceptions get raised in turnOnFilesystems for the time being.
Diffstat (limited to 'packages.py')
-rw-r--r--packages.py199
1 files changed, 101 insertions, 98 deletions
diff --git a/packages.py b/packages.py
index 5e51c8135..9d763896f 100644
--- a/packages.py
+++ b/packages.py
@@ -87,119 +87,122 @@ def copyAnacondaLogs(anaconda):
except:
pass
-def doMigrateFilesystems(anaconda):
- if anaconda.dir == DISPATCH_BACK:
- return DISPATCH_NOOP
-
- if anaconda.id.fsset.haveMigratedFilesystems():
- return DISPATCH_NOOP
-
- anaconda.id.fsset.migrateFilesystems (anaconda)
-
- if anaconda.id.upgrade:
- # if we're upgrading, we may need to do lvm device node hackery
- anaconda.id.fsset.makeLVMNodes(anaconda.rootPath, trylvm1 = 1)
- # and 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.fsset.write(anaconda.rootPath)
- # and make sure /dev is mounted so we can read the bootloader
- bindMountDevDirectory(anaconda.rootPath)
-
def turnOnFilesystems(anaconda):
if anaconda.dir == DISPATCH_BACK:
- log.info("unmounting filesystems")
- anaconda.id.fsset.umountFilesystems(anaconda.rootPath)
- return
+ if not anaconda.id.upgrade:
+ log.info("unmounting filesystems")
+ anaconda.id.storage.fsset.umountFilesystems(anaconda.rootPath)
+ return DISPATCH_NOOP
if flags.setupFilesystems:
if not anaconda.id.upgrade:
- if not anaconda.id.fsset.isActive():
+ if not anaconda.id.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",
searchPath = 1)
- try:
- anaconda.id.storage.processActions(anaconda.intf)
- except DeviceResizeError as (msg, device):
- # XXX does this make any sense? do we support resize of
- # devices other than partitions?
- anaconda.intf.detailedMessageWindow(_("Device Resize Failed"),
- _("An error was encountered while "
- "resizing device %s.") % (device,),
- msg,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
- except DeviceCreateError as (msg, device):
- anaconda.intf.detailedMessageWindow(_("Device Creation Failed"),
- _("An error was encountered while "
- "creating device %s.") % (device,),
- msg,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
- except DeviceDestroyError as (msg, device):
- anaconda.intf.detailedMessageWindow(_("Device Removal Failed"),
- _("An error was encountered while "
- "removing device %s.") % (device,),
- msg,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
- except DeviceError as (msg, device):
- anaconda.intf.detailedMessageWindow(_("Device Setup Failed"),
- _("An error was encountered while "
- "setting up device %s.") % (device,),
- msg,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
- except FSResizeError as (msg, device):
- if os.path.exists("/tmp/resize.out"):
- details = open("/tmp/resize.out", "r").read()
- else:
- details = "%s" %(msg,)
- anaconda.intf.detailedMessageWindow(_("Resizing Failed"),
- _("There was an error encountered while "
- "resizing the device %s.") %(device,),
- details,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
- except FSMigrateError as (msg, device):
- anaconda.intf.detailedMessageWindow(_("Migration Failed"),
- _("An error was encountered while "
- "migrating filesystem on device %s.")
- % (device,),
- msg,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
- except FormatCreateError as (msg, device):
- anaconda.intf.detailedMessageWindow(_("Formatting Failed"),
- _("An error was encountered while "
- "formatting device %s.") % (device,),
- msg,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
- except Exception as msg:
- # catch-all
- anaconda.intf.detailedMessageWindow(_("Storage Activation Failed"),
- _("An error was encountered while "
- "activating your storage configuration.")
- msg,
- type = "custom",
- custom_buttons = [_("_Exit installer")])
- sys.exit(1)
-
- anaconda.id.fsset.turnOnSwap(anaconda.intf)
+ upgrade_migrate = False
+ if anaconda.id.upgrade:
+ for d in anaconda.id.storage.fsset.migratableDevices:
+ if d.migrate:
+ upgrade_migrate = True
+
+ try:
+ anaconda.id.storage.doIt()
+ except Exception:
+ # better to get ful exceptions for debugging
+ raise
+ except DeviceResizeError as (msg, device):
+ # XXX does this make any sense? do we support resize of
+ # devices other than partitions?
+ anaconda.intf.detailedMessageWindow(_("Device Resize Failed"),
+ _("An error was encountered while "
+ "resizing device %s.") % (device,),
+ msg,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+ except DeviceCreateError as (msg, device):
+ anaconda.intf.detailedMessageWindow(_("Device Creation Failed"),
+ _("An error was encountered while "
+ "creating device %s.") % (device,),
+ msg,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+ except DeviceDestroyError as (msg, device):
+ anaconda.intf.detailedMessageWindow(_("Device Removal Failed"),
+ _("An error was encountered while "
+ "removing device %s.") % (device,),
+ msg,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+ except DeviceError as (msg, device):
+ anaconda.intf.detailedMessageWindow(_("Device Setup Failed"),
+ _("An error was encountered while "
+ "setting up device %s.") % (device,),
+ msg,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+ except FSResizeError as (msg, device):
+ if os.path.exists("/tmp/resize.out"):
+ details = open("/tmp/resize.out", "r").read()
+ else:
+ details = "%s" %(msg,)
+ anaconda.intf.detailedMessageWindow(_("Resizing Failed"),
+ _("There was an error encountered while "
+ "resizing the device %s.") %(device,),
+ details,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+ except FSMigrateError as (msg, device):
+ anaconda.intf.detailedMessageWindow(_("Migration Failed"),
+ _("An error was encountered while "
+ "migrating filesystem on device %s.")
+ % (device,),
+ msg,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+ except FormatCreateError as (msg, device):
+ anaconda.intf.detailedMessageWindow(_("Formatting Failed"),
+ _("An error was encountered while "
+ "formatting device %s.") % (device,),
+ msg,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+ except Exception as msg:
+ # catch-all
+ anaconda.intf.detailedMessageWindow(_("Storage Activation Failed"),
+ _("An error was encountered while "
+ "activating your storage configuration."),
+ msg,
+ type = "custom",
+ custom_buttons = [_("_Exit installer")])
+ sys.exit(1)
+
+ if not anaconda.id.upgrade:
+ anaconda.id.storage.fsset.turnOnSwap(anaconda.intf)
anaconda.id.storage.fsset.mountFilesystems(anaconda,
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)
+
+ # and make sure /dev is mounted so we can read the bootloader
+ bindMountDevDirectory(anaconda.rootPath)
+
def setupTimezone(anaconda):
# we don't need this on an upgrade or going backwards