From ae1b0e9630c66bc819c31b5469f9819157a7a2f5 Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Mon, 21 Nov 2011 09:40:53 -0600
Subject: [PATCH 07/12] Add new field to PartSpec to indicate btrfs reqs.

Things that should be on lvm should not necessarily be on btrfs.
---
 pyanaconda/installclass.py     |    6 +++---
 pyanaconda/platform.py         |    2 +-
 pyanaconda/storage/partspec.py |   26 +++++++++++++++-----------
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 0d784f2..f2774da 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -175,10 +175,10 @@ class BaseInstallClass(object):
     def setDefaultPartitioning(self, storage, platform):
         autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType,
                                  size=1024, maxSize=50*1024, grow=True,
-                                 asVol=True, encrypted=True),
+                                 btr=True, lv=True, encrypted=True),
                         PartSpec(mountpoint="/home", fstype=storage.defaultFSType,
                                  size=500, grow=True, requiredSpace=50*1024,
-                                 asVol=True, encrypted=True)]
+                                 btr=True, lv=True, encrypted=True)]
 
         bootreq = platform.setDefaultPartitioning()
         if bootreq:
@@ -186,7 +186,7 @@ class BaseInstallClass(object):
 
         (minswap, maxswap) = iutil.swapSuggestion()
         autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
-                                     grow=True, asVol=True, encrypted=True))
+                                     grow=True, lv=True, encrypted=True))
 
         storage.autoPartitionRequests = autorequests
 
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index c70b882..ab4b80c 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -289,7 +289,7 @@ class S390(Platform):
         from storage.partspec import PartSpec
         return [PartSpec(mountpoint="/boot", size=500,
                          fstype=self.anaconda.storage.defaultBootFSType,
-                         weight=self.weight(mountpoint="/boot"), asVol=True,
+                         weight=self.weight(mountpoint="/boot"), lv=True,
                          singlePV=True)]
 
     def requiredDiskLabelType(self, device_type):
diff --git a/pyanaconda/storage/partspec.py b/pyanaconda/storage/partspec.py
index 1602b8a..97cb33e 100644
--- a/pyanaconda/storage/partspec.py
+++ b/pyanaconda/storage/partspec.py
@@ -21,25 +21,27 @@
 
 class PartSpec(object):
     def __init__(self, mountpoint=None, fstype=None, size=None, maxSize=None,
-                 grow=False, asVol=False, singlePV=False, weight=0,
+                 grow=False, btr=False, lv=False, singlePV=False, weight=0,
                  requiredSpace=0, encrypted=False):
         """ Create a new storage specification.  These are used to specify
             the default partitioning layout as an object before we have the
             storage system up and running.  The attributes are obvious
             except for the following:
 
-            asVol -- Should this be allocated as a logical volume?  If not,
-                     it will be allocated as a partition.
+            btr -- Should this be allocated as a btrfs subvolume?  If not,
+                   it will be allocated as a partition.
+            lv -- Should this be allocated as a logical volume?  If not,
+                  it will be allocated as a partition.
             singlePV -- Should this logical volume map to a single physical
-                        volume in the volume group?  Implies asVol=True
+                        volume in the volume group?  Implies lv=True
             weight -- An integer that modifies the sort algorithm for partition
                       requests.  A larger value means the partition will end up
                       closer to the front of the disk.  This is mainly used to
                       make sure /boot ends up in front, and any special (PReP,
                       appleboot, etc.) partitions end up in front of /boot.
-                      This value means nothing if asVol=False.
+                      This value means nothing unless lv and btr are both False.
             requiredSpace -- This value is only taken into account if
-                             asVol=True, and specifies the size in MB that the
+                             lv=True, and specifies the size in MB that the
                              containing VG must be for this PartSpec to even
                              get used.  The VG's size is calculated before any
                              other LVs are created inside it.  If not enough
@@ -55,22 +57,24 @@ class PartSpec(object):
         self.size = size
         self.maxSize = maxSize
         self.grow = grow
-        self.asVol = asVol
+        self.lv = lv
+        self.btr = btr
         self.singlePV = singlePV
         self.weight = weight
         self.requiredSpace = requiredSpace
         self.encrypted = encrypted
 
-        if self.singlePV and not self.asVol:
-            self.asVol = True
+        if self.singlePV and not self.lv:
+            self.lv = True
 
     def __str__(self):
         s = ("%(type)s instance (%(id)s) -- \n"
-             "  mountpoint = %(mountpoint)s  asVol = %(asVol)s  singlePV = %(singlePV)s\n"
+             "  mountpoint = %(mountpoint)s  lv = %(lv)s  singlePV = %(singlePV)s"
+             "  btrfs = %(btrfs)s\n"
              "  weight = %(weight)s  fstype = %(fstype)s  encrypted = %(enc)s\n"
              "  size = %(size)s  maxSize = %(maxSize)s  grow = %(grow)s\n" %
              {"type": self.__class__.__name__, "id": "%#x" % id(self),
-              "mountpoint": self.mountpoint, "asVol": self.asVol,
+              "mountpoint": self.mountpoint, "lv": self.lv, "btrfs": self.btr,
               "singlePV": self.singlePV, "weight": self.weight,
               "fstype": self.fstype, "size": self.size, "enc": self.encrypted,
               "maxSize": self.maxSize, "grow": self.grow})
-- 
1.7.3.4

