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

[PATCH] Add Storage.autoPartType to indicate lvm/btrfs/neither.



This accompanies a kickstart option to autopart, type:

  autopart --type=lvm|btrfs|plain
---
 pyanaconda/iw/autopart_type.py     |    6 +++---
 pyanaconda/kickstart.py            |    6 +++---
 pyanaconda/storage/__init__.py     |    3 +--
 pyanaconda/storage/partitioning.py |   16 ++++++++--------
 4 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/pyanaconda/iw/autopart_type.py b/pyanaconda/iw/autopart_type.py
index 6dca7e1..5ea243d 100644
--- a/pyanaconda/iw/autopart_type.py
+++ b/pyanaconda/iw/autopart_type.py
@@ -191,9 +191,9 @@ class PartitionTypeWindow(InstallWindow):
             self.dispatch.request_steps_gently("cleardiskssel")
 
             if self.lvmButton.get_active():
-                self.storage.lvmAutoPart = True
+                self.storage.autoPartType = AUTOPART_TYPE_LVM
             else:
-                self.storage.lvmAutoPart = False
+                self.storage.autoPartType = AUTOPART_TYPE_PLAIN
 
             if self.encryptButton.get_active():
                 self.storage.encryptedAutoPart = True
@@ -263,7 +263,7 @@ class PartitionTypeWindow(InstallWindow):
         self.reviewButton.set_active(
             step_data.get("review_checked", self.dispatch.step_enabled("partition")))
         self.encryptButton.set_active(self.storage.encryptedAutoPart)
-        self.lvmButton.set_active(self.storage.lvmAutoPart)
+        self.lvmButton.set_active(self.storage.autoPartType == AUTOPART_TYPE_LVM)
 
         self.buttonGroup = pixmapRadioButtonGroup()
         self.buttonGroup.addEntry("all", _("Use _All Space"),
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index cdb3d36..27cf6d1 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -231,7 +231,7 @@ class Authconfig(commands.authconfig.FC3_Authconfig):
     def execute(self):
         self.anaconda.security.auth = self.authconfig
 
-class AutoPart(commands.autopart.F16_AutoPart):
+class AutoPart(commands.autopart.F17_AutoPart):
     def execute(self):
         # sets up default autopartitioning.  use clearpart separately
         # if you want it
@@ -246,8 +246,8 @@ class AutoPart(commands.autopart.F16_AutoPart):
             self.anaconda.storage.autoPartAddBackupPassphrase = \
                 self.backuppassphrase
 
-        if not self.lvm:
-            self.anaconda.storage.lvmAutoPart = False
+        if self.type is not None:
+            self.anaconda.storage.autoPartType = self.type
 
         self.anaconda.dispatch.skip_steps("partition", "parttype")
 
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 487afe2..f52d7b7 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -340,8 +340,7 @@ class Storage(object):
         self.doAutoPart = False
         self.clearPartChoice = None
         self.encryptedAutoPart = False
-        self.lvmAutoPart = False
-        self.btrfsAutoPart = True
+        self.autoPartType = AUTOPART_TYPE_LVM
         self.encryptionPassphrase = None
         self.escrowCertificates = {}
         self.autoPartEscrowCert = None
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 8669c82..b00d5a4 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -68,7 +68,7 @@ def _scheduleImplicitPartitions(storage, disks):
     devs = []
 
     # only schedule the partitions if either lvm or btrfs autopart was chosen
-    if not storage.lvmAutoPart and not storage.btrfsAutoPart:
+    if storage.autoPartType not in (AUTOPART_TYPE_LVM, AUTOPART_TYPE_BTRFS):
         return devs
 
     for disk in disks:
@@ -77,7 +77,7 @@ def _scheduleImplicitPartitions(storage, disks):
             fmt_args = {"escrow_cert": storage.autoPartEscrowCert,
                         "add_backup_passphrase": storage.autoPartAddBackupPassphrase}
         else:
-            if storage.lvmAutoPart:
+            if storage.autoPartType == AUTOPART_TYPE_LVM:
                 fmt_type = "lvmpv"
             else:
                 fmt_type = "btrfs"
@@ -111,8 +111,8 @@ def _schedulePartitions(storage, disks):
     # First pass is for partitions only. We'll do LVs later.
     #
     for request in storage.autoPartitionRequests:
-        if (request.lv and storage.lvmAutoPart) or \
-           (request.btr and storage.btrfsAutoPart):
+        if (request.lv and storage.autoPartType == AUTOPART_TYPE_LVM) or \
+           (request.btr and storage.autoPartType == AUTOPART_TYPE_BTRFS):
             continue
 
         if request.requiredSpace and request.requiredSpace > free:
@@ -181,7 +181,7 @@ def _scheduleVolumes(storage, devs):
     if not devs:
         return
 
-    if storage.lvmAutoPart:
+    if storage.autoPartType == AUTOPART_TYPE_LVM:
         new_container = storage.newVG
         new_volume = storage.newLV
         format_name = "lvmpv"
@@ -214,8 +214,8 @@ def _scheduleVolumes(storage, devs):
     #
     # Second pass, for LVs only.
     for request in storage.autoPartitionRequests:
-        btr = storage.btrfsAutoPart and request.btr
-        lv = storage.lvmAutoPart and request.lv
+        btr = storage.autoPartType == AUTOPART_TYPE_BTRFS and request.btr
+        lv = storage.autoPartType == AUTOPART_TYPE_LVM and request.lv
 
         if not btr and not lv:
             continue
@@ -275,7 +275,7 @@ def doAutoPartition(anaconda):
     log.debug("doAutoPartition(%s)" % anaconda)
     log.debug("doAutoPart: %s" % anaconda.storage.doAutoPart)
     log.debug("encryptedAutoPart: %s" % anaconda.storage.encryptedAutoPart)
-    log.debug("lvmAutoPart: %s" % anaconda.storage.lvmAutoPart)
+    log.debug("autoPartType: %s" % anaconda.storage.autoPartType)
     log.debug("clearPartType: %s" % anaconda.storage.config.clearPartType)
     log.debug("clearPartDisks: %s" % anaconda.storage.config.clearPartDisks)
     log.debug("autoPartitionRequests:\n%s" % "".join([str(p) for p in anaconda.storage.autoPartitionRequests]))
-- 
1.7.3.4


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