Re: BZ# 70477, unwanted swap partitions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joel Andres Granados wrote:
Jesse Keating wrote:
On Wed, 15 Aug 2007 13:31:27 +0200
Joel Andres Granados <jgranado@xxxxxxxxxx> wrote:

Successfully created a ignoreswadev ksoption.  It makes anaconda
ignore the swap devices at install time and in the resulting fstab.
There is still an issue regarding the installation,  When I tested a
system that only had 1 swap device the installer froze.  When I
increased ram it continued installing (vmware, basically increased
from 256 to 512). Question: does anaconda need a swap partition to
complete installation ?  I'll post the patch after some more tests :)

Under certain low memory situations anaconda will ask if it can mount
and use your configured swap space.  256 megs of ram sounds like such a
scenario.

Yes, I supposed as much, the funny thing is that anaconda does not scream about there being no available memory, it just freezes. Have to see if this is regarding my
patch or should be addresses as some other bug.

Just tested it with 400 Mb.  It seems to be installing just fine :)
thx for the info.

oops. When installing the Kernel the hit an error and bailed out (with 400Mb). Didn't catch the traceback.
staring again :)
.....
Got it to install with 450MB of memory. I installed @core and @base (and all its deps). And to the best of my knowledge it does not use the swap devices that the user does not want to. Preparing the patch ...
.....
here are the patches.  for both pykickstart and anaconda :)
Comments appreciated:)

--
Joel Andres Granados

diff -ur anaconda-11.3.0.19/fsset.py anaconda-11.3.0.19-JG/fsset.py
--- anaconda-11.3.0.19/fsset.py	2007-08-13 16:06:28.000000000 +0200
+++ anaconda-11.3.0.19-JG/fsset.py	2007-08-15 14:13:06.000000000 +0200
@@ -1123,8 +1123,10 @@
     def fstab (self):
 	format = "%-23s %-23s %-7s %-15s %d %d\n"
         fstab = ""
+        #import pdb
+        #pdb.set_trace()
         for entry in self.entries:
-            if entry.mountpoint:
+            if entry.mountpoint and entry.device.getDevice() not in partedUtils.DiskSet.skippedSwapDevs:
                 if entry.getLabel():
                     device = "LABEL=%s" % (entry.getLabel(),)
                 else:
@@ -1401,7 +1403,7 @@
 
         for entry in self.entries:
             if (entry.fsystem and entry.fsystem.getName() == "swap"
-                and not entry.isMounted()):
+                and not entry.isMounted() and entry.device.getDevice() not in partedUtils.DiskSet.skippedSwapDevs):
                 try:
                     entry.mount(chroot)
                     self.mountcount = self.mountcount + 1
diff -ur anaconda-11.3.0.19/installclass.py anaconda-11.3.0.19-JG/installclass.py
--- anaconda-11.3.0.19/installclass.py	2007-07-16 17:55:32.000000000 +0200
+++ anaconda-11.3.0.19-JG/installclass.py	2007-08-15 12:22:00.000000000 +0200
@@ -116,6 +116,12 @@
             if not drive in diskset.skippedDisks:
                 diskset.skippedDisks.append(drive)
 
+    def setIgnoredSwapDev(self, id, devs):
+        diskset = id.diskset
+        for dev in devs:
+            if not dev in diskset.skippedSwapDevs:
+                diskset.skippedSwapDevs.append(dev)
+
     def setExclusiveDisks(self, id, drives):
         diskset = id.diskset
         for drive in drives:
diff -ur anaconda-11.3.0.19/kickstart.py anaconda-11.3.0.19-JG/kickstart.py
--- anaconda-11.3.0.19/kickstart.py	2007-07-31 21:29:34.000000000 +0200
+++ anaconda-11.3.0.19-JG/kickstart.py	2007-08-15 12:22:01.000000000 +0200
@@ -178,6 +178,11 @@
         commands.firstboot.FC3_Firstboot.parse(self, args)
         self.handler.id.firstboot = self.firstboot
 
+class IgnoreSwapDev(commands.ignoreswapdev.F8_IgnoreSwapDev):
+    def parse(self, args):
+        commands.ignoreswapdev.F8_IgnoreSwapDev.parse(self, args)
+        self.handler.id.instClass.setIgnoredSwapDev(self.handler.id, self.devs)
+
 class IgnoreDisk(commands.ignoredisk.F8_IgnoreDisk):
     def parse(self, args):
         commands.ignoredisk.F8_IgnoreDisk.parse(self, args)
@@ -676,6 +681,7 @@
         "halt": Reboot,
         "harddrive": commands.method.FC6_Method,
         "ignoredisk": IgnoreDisk,
+        "ignoreswapdev": IgnoreSwapDev,
         "install": Upgrade,
         "interactive": commands.interactive.FC3_Interactive,
         "iscsi": Iscsi,
diff -ur anaconda-11.3.0.19/partedUtils.py anaconda-11.3.0.19-JG/partedUtils.py
--- anaconda-11.3.0.19/partedUtils.py	2007-07-26 16:15:43.000000000 +0200
+++ anaconda-11.3.0.19-JG/partedUtils.py	2007-08-15 09:28:37.000000000 +0200
@@ -595,6 +595,7 @@
     """The disks in the system."""
 
     skippedDisks = []
+    skippedSwapDevs = []
     mdList = []
     clearedDisks = []
     exclusiveDisks = []
diff -ru --new-file pykickstart-1.8/pykickstart/commands/ignoreswapdev.py pykickstart-1.8-JG/pykickstart/commands/ignoreswapdev.py
--- pykickstart-1.8/pykickstart/commands/ignoreswapdev.py	1970-01-01 01:00:00.000000000 +0100
+++ pykickstart-1.8-JG/pykickstart/commands/ignoreswapdev.py	2007-08-15 15:25:51.000000000 +0200
@@ -0,0 +1,50 @@
+#
+# Chris Lumens <clumens@xxxxxxxxxx>
+#
+# Copyright 2005, 2006, 2007 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the GNU
+# General Public License v.2.  This program is distributed in the hope that it
+# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
+# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
+# trademarks that are incorporated in the source code or documentation are not
+# subject to the GNU General Public License and may only be used or replicated
+# with the express permission of Red Hat, Inc. 
+#
+import string
+
+from pykickstart.base import *
+from pykickstart.options import *
+
+class F8_IgnoreSwapDev(KickstartCommand):
+    def __init__(self, writePriority=0, ignoreswapdev=None):
+        KickstartCommand.__init__(self, writePriority)
+
+        if ignoreswapdev == None:
+            ignoreswapdev = []
+
+        self.ignoreswapdev = ignoreswapdev
+
+    def __str__(self):
+        if len(self.ignoreswapdev) > 0:
+            return "ignoreswapdev --devs=%s\n" % string.join(self.ignoreswapdev, ",")
+        else:
+            return ""
+
+    def parse(self, args):
+        def dev_cb (option, opt_str, value, parser):
+            for d in value.split(','):
+                parser.values.ensure_value(option.dest, []).append(d)
+
+        op = KSOptionParser(lineno=self.lineno)
+        op.add_option("--devs", dest="devs", action="callback",
+                      callback=dev_cb, nargs=1, type="string")
+
+        (opts, extra) = op.parse_args(args=args)
+        self._setToSelf(op, opts)
diff -ru --new-file pykickstart-1.8/pykickstart/commands/__init__.py pykickstart-1.8-JG/pykickstart/commands/__init__.py
--- pykickstart-1.8/pykickstart/commands/__init__.py	2007-08-09 20:51:38.000000000 +0200
+++ pykickstart-1.8-JG/pykickstart/commands/__init__.py	2007-08-15 10:54:07.000000000 +0200
@@ -23,4 +23,4 @@
 import langsupport, lilocheck, logging, logvol, mediacheck, method, monitor
 import mouse, multipath, network, partition, raid, reboot, repo, rootpw
 import selinux, services, skipx, timezone, updates, upgrade, user, vnc
-import volgroup, xconfig, zerombr, zfcp
+import volgroup, xconfig, zerombr, zfcp, ignoreswapdev
diff -ru --new-file pykickstart-1.8/pykickstart/handlers/control.py pykickstart-1.8-JG/pykickstart/handlers/control.py
--- pykickstart-1.8/pykickstart/handlers/control.py	2007-08-09 20:51:38.000000000 +0200
+++ pykickstart-1.8-JG/pykickstart/handlers/control.py	2007-08-15 09:34:02.000000000 +0200
@@ -313,6 +313,7 @@
         "halt": reboot.FC6_Reboot,
         "harddrive": method.FC6_Method,
         "ignoredisk": ignoredisk.F8_IgnoreDisk,
+        "ignoreswapdev": ignoreswapdev.F8_IgnoreSwapDev,
         "install": upgrade.FC3_Upgrade,
         "interactive": interactive.FC3_Interactive,
         "iscsi": iscsi.FC6_Iscsi,

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux