From 3fa0ea845fa9d3ce004f18ab100a9655eb38fd5a Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Mon, 6 Aug 2012 09:55:12 -0500
Subject: [PATCH 12/14] Streamline autopart request setup slightly.

The storage instance contains a platform instance, so there's no need
to pass one in explicitly.

Also, setDefaultPartitioning seems to be a good place to set fstype
for boot requests only once.
---
 pyanaconda/installclass.py          |   15 +++++++++++----
 pyanaconda/installclasses/fedora.py |    4 +---
 pyanaconda/installclasses/rhel.py   |    4 +---
 pyanaconda/kickstart.py             |    3 +--
 pyanaconda/platform.py              |    2 --
 pyanaconda/storage/partitioning.py  |    6 ------
 6 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 17a0c11..3f7bc67 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -104,7 +104,7 @@ class BaseInstallClass(object):
         # provided as a way for other products to specify their own.
         return None
 
-    def setDefaultPartitioning(self, storage, platform):
+    def setDefaultPartitioning(self, storage):
         autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType,
                                  size=1024, maxSize=50*1024, grow=True,
                                  btr=True, lv=True, encrypted=True),
@@ -112,14 +112,21 @@ class BaseInstallClass(object):
                                  size=500, grow=True, requiredSpace=50*1024,
                                  btr=True, lv=True, encrypted=True)]
 
-        bootreq = platform.setDefaultPartitioning()
-        if bootreq:
-            autorequests.extend(bootreq)
+        bootreqs = storage.platform.setDefaultPartitioning()
+        if bootreqs:
+            autorequests.extend(bootreqs)
 
         (minswap, maxswap) = iutil.swapSuggestion()
         autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
                                      grow=True, lv=True, encrypted=True))
 
+        for autoreq in autorequests:
+            if autoreq.fstype is None:
+                if autoreq.mountpoint == "/boot":
+                    autoreq.fstype = storage.defaultBootFSType
+                else:
+                    autoreq.fstype = storage.defaultFSType
+
         storage.autoPartitionRequests = autorequests
 
     def configure(self, anaconda):
diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
index e2c1543..ae1abf0 100644
--- a/pyanaconda/installclasses/fedora.py
+++ b/pyanaconda/installclasses/fedora.py
@@ -76,9 +76,7 @@ class InstallClass(BaseInstallClass):
 
     def configure(self, anaconda):
 	BaseInstallClass.configure(self, anaconda)
-        BaseInstallClass.setDefaultPartitioning(self,
-                                                anaconda.storage,
-                                                anaconda.platform)
+        BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
 
     def setGroupSelection(self, anaconda):
         BaseInstallClass.setGroupSelection(self, anaconda)
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
index 339b5b8..0e36d26 100644
--- a/pyanaconda/installclasses/rhel.py
+++ b/pyanaconda/installclasses/rhel.py
@@ -55,9 +55,7 @@ class InstallClass(BaseInstallClass):
 
     def configure(self, anaconda):
         BaseInstallClass.configure(self, anaconda)
-        BaseInstallClass.setDefaultPartitioning(self,
-                                                anaconda.storage,
-                                                anaconda.platform)
+        BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
 
     def productMatches(self, oldprod):
         if oldprod is None:
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 02e62c3..284ab9b 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -234,7 +234,6 @@ class Authconfig(commands.authconfig.FC3_Authconfig):
 
 class AutoPart(commands.autopart.F17_AutoPart):
     def execute(self, storage, ksdata, instClass):
-        from pyanaconda.platform import getPlatform
         from pyanaconda.storage.partitioning import doAutoPartition
 
         if not self.autopart:
@@ -242,7 +241,7 @@ class AutoPart(commands.autopart.F17_AutoPart):
 
         # sets up default autopartitioning.  use clearpart separately
         # if you want it
-        instClass.setDefaultPartitioning(storage, getPlatform())
+        instClass.setDefaultPartitioning(storage)
         storage.doAutoPart = True
 
         if self.encrypted:
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index 9abf0f5..7eb05af 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -310,8 +310,6 @@ class S390(Platform):
         """Return the default platform-specific partitioning information."""
         from storage.partspec import PartSpec
         return [PartSpec(mountpoint="/boot", size=500,
-#TODO: need to pass this info in w/o using anaconda object
-#                        fstype=self.anaconda.storage.defaultBootFSType,
                          weight=self.weight(mountpoint="/boot"), lv=True,
                          singlePV=True)]
 
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 3b55f99..f7060f3 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -131,12 +131,6 @@ def _schedulePartitions(storage, disks):
         if request.requiredSpace and request.requiredSpace > free:
             continue
 
-        if request.fstype is None:
-            if request.mountpoint == "/boot":
-                request.fstype = storage.defaultBootFSType
-            else:
-                request.fstype = storage.defaultFSType
-
         elif request.fstype in ("prepboot", "efi", "biosboot", "hfs+") and \
              stage1_device:
             # there should never be a need for more than one of these
-- 
1.7.7.6

