summaryrefslogtreecommitdiffstats
path: root/fsset.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-03-28 19:05:00 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-03-28 19:05:00 +0000
commit231b7ef4cfed9e848f9c64f0f5b7e78fe04a3ae9 (patch)
treeae8f2a8558c102a79647de2c7446faa628d0de7f /fsset.py
parentff16e17a50d76bf87a0f0b5d1d477f6ce7727b87 (diff)
downloadanaconda-231b7ef4cfed9e848f9c64f0f5b7e78fe04a3ae9.tar.gz
anaconda-231b7ef4cfed9e848f9c64f0f5b7e78fe04a3ae9.tar.xz
anaconda-231b7ef4cfed9e848f9c64f0f5b7e78fe04a3ae9.zip
Took care of a FIXME...
* fsset.py (swapFileSystems.mount): If the signature is SWAP-SPACE, raise OldSwapError so we can ask the user to reformat or skip it (#122101). * fsset.py (FileSystemSet.turnOnSwap): Added swapErrorDialog function to handle the OldSwapError and SuspendError exceptions.
Diffstat (limited to 'fsset.py')
-rw-r--r--fsset.py49
1 files changed, 30 insertions, 19 deletions
diff --git a/fsset.py b/fsset.py
index ea19bed59..eba91f2f0 100644
--- a/fsset.py
+++ b/fsset.py
@@ -43,6 +43,9 @@ class BadBlocksError(Exception):
class SuspendError(Exception):
pass
+class OldSwapError(Exception):
+ pass
+
defaultMountPoints = ['/', '/home', '/tmp', '/usr', '/var', '/usr/local', '/opt']
if rhpl.getArch() == "s390":
@@ -745,7 +748,6 @@ class swapFileSystem(FileSystemType):
self.supported = 1
self.maxLabelChars = 15
-
def mount(self, device, mountpoint, readOnly=0, bindMount=0):
pagesize = resource.getpagesize()
buf = None
@@ -760,13 +762,10 @@ class swapFileSystem(FileSystemType):
except:
pass
- # FIXME: we should ask if they want to reinitialize swaps that
- # are of format 0 (#122101)
if buf is not None and len(buf) == pagesize:
sig = buf[pagesize - 10:]
if sig == 'SWAP-SPACE':
- log.warning("SWAP is of format 0, skipping it")
- return
+ raise OldSwapError
if sig == 'S1SUSPEND\x00' or sig == 'S2SUSPEND\x00':
raise SuspendError
@@ -1465,12 +1464,36 @@ MAILADDR root
entry.setLabel(label)
def turnOnSwap (self, chroot, upgrading=False):
+ def swapErrorDialog (msg, format_button_text, entry):
+ buttons = [_("Skip"), format_button_text, _("Reboot")]
+ ret = self.messageWindow(_("Error"), msg, type="custom",
+ custom_buttons=buttons,
+ custom_icon="warning")
+ if ret == 0:
+ self.entries.remove(entry)
+ elif ret == 1:
+ self.formatEntry(entry, chroot)
+ entry.mount(chroot)
+ self.mountcount = self.mountcount + 1
+ else:
+ sys.exit(0)
+
for entry in self.entries:
if (entry.fsystem and entry.fsystem.getName() == "swap"
and not entry.isMounted()):
try:
entry.mount(chroot)
self.mountcount = self.mountcount + 1
+ except OldSwapError:
+ if self.messageWindow:
+ msg = _("The swap device:\n\n /dev/%s\n\n"
+ "is a version 0 Linux swap partition. If you "
+ "want to use this device, you must reformat as "
+ "a version 1 Linux swap partition. If you skip "
+ "it, the installer will ignore it during the "
+ "installation.") % (entry.device.getDevice())
+
+ swapErrorDialog(msg, _("Reformat"), entry)
except SuspendError:
if self.messageWindow:
if upgrading:
@@ -1497,20 +1520,8 @@ MAILADDR root
"the upgrade. Choose Format to reformat "
"the partition as swap space. Choose Reboot "
"to restart the system.")
- adv = self.messageWindow(_("Error"), msg, type="custom",
- custom_buttons=[_("Skip"),
- _("Format"),
- _("Reboot")],
- custom_icon="warning")
-
- if adv == 0:
- self.entries.remove(entry)
- elif adv == 1:
- self.formatEntry(entry, chroot)
- entry.mount(chroot)
- self.mountcount = self.mountcount + 1
- else:
- sys.exit(0)
+
+ swapErrorDialog(msg, _("Format"), entry)
else:
sys.exit(0)
except SystemError, (num, msg):