zengxyz / rpms / anaconda

Forked from rpms/anaconda 4 months ago
Clone
fbcaed
From 4808f43abc14396add62e9b0a92fbe8cf5b41346 Mon Sep 17 00:00:00 2001
fbcaed
From: Radek Vykydal <rvykydal@redhat.com>
fbcaed
Date: Tue, 21 Oct 2014 17:46:47 +0200
fbcaed
Subject: [PATCH 30/30] atomic: set up atomic specific partitioning defaults
fbcaed
fbcaed
Resolves: rhbz#1155452
fbcaed
fbcaed
/boot will be 300M and / LV will be 3G. LVs for docker will be created by special
fbcaed
service using root's VG.
fbcaed
---
fbcaed
 pyanaconda/installclasses/rhel.py | 36 ++++++++++++++++++++++++++++++++++--
fbcaed
 1 file changed, 34 insertions(+), 2 deletions(-)
fbcaed
fbcaed
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
fbcaed
index b7691cf..a9a99f6 100644
fbcaed
--- a/pyanaconda/installclasses/rhel.py
fbcaed
+++ b/pyanaconda/installclasses/rhel.py
fbcaed
@@ -24,11 +24,15 @@ from pyanaconda import network
fbcaed
 from pyanaconda import nm
fbcaed
 from pyanaconda import iutil
fbcaed
 import types
fbcaed
+from pyanaconda.kickstart import getAvailableDiskSpace
fbcaed
+from blivet.partspec import PartSpec
fbcaed
+from blivet.platform import platform
fbcaed
+from blivet.devicelibs import swap
fbcaed
 
fbcaed
 class RHELBaseInstallClass(BaseInstallClass):
fbcaed
     name = "Red Hat Enterprise Linux"
fbcaed
     sortPriority = 20000
fbcaed
-    if not productName.startswith(("Red Hat ", "RHEL Atomic")):
fbcaed
+    if not productName.startswith("Red Hat "):
fbcaed
         hidden = True
fbcaed
     defaultFS = "xfs"
fbcaed
 
fbcaed
@@ -45,7 +49,7 @@ class RHELBaseInstallClass(BaseInstallClass):
fbcaed
 
fbcaed
     def configure(self, anaconda):
fbcaed
         BaseInstallClass.configure(self, anaconda)
fbcaed
-        BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
fbcaed
+        self.setDefaultPartitioning(anaconda.storage)
fbcaed
 
fbcaed
     # Set first boot policy regarding ONBOOT value
fbcaed
     # (i.e. which network devices should be activated automatically after reboot)
fbcaed
@@ -84,3 +88,31 @@ class RHELBaseInstallClass(BaseInstallClass):
fbcaed
 
fbcaed
     def __init__(self):
fbcaed
         BaseInstallClass.__init__(self)
fbcaed
+
fbcaed
+class RHELAtomicInstallClass(RHELBaseInstallClass):
fbcaed
+    name = "RHEL Atomic Host"
fbcaed
+    if productName.startswith("RHEL Atomic"):
fbcaed
+        hidden = False
fbcaed
+
fbcaed
+    def setDefaultPartitioning(self, storage):
fbcaed
+        autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType,
fbcaed
+                                size=1024, maxSize=3*1024, grow=True, lv=True)]
fbcaed
+
fbcaed
+        bootreqs = platform.setDefaultPartitioning()
fbcaed
+        if bootreqs:
fbcaed
+            autorequests.extend(bootreqs)
fbcaed
+
fbcaed
+        disk_space = getAvailableDiskSpace(storage)
fbcaed
+        swp = swap.swapSuggestion(disk_space=disk_space)
fbcaed
+        autorequests.append(PartSpec(fstype="swap", size=swp, grow=False,
fbcaed
+                                    lv=True, encrypted=True))
fbcaed
+
fbcaed
+        for autoreq in autorequests:
fbcaed
+            if autoreq.fstype is None:
fbcaed
+                if autoreq.mountpoint == "/boot":
fbcaed
+                    autoreq.fstype = storage.defaultBootFSType
fbcaed
+                    autoreq.size = 300
fbcaed
+                else:
fbcaed
+                    autoreq.fstype = storage.defaultFSType
fbcaed
+
fbcaed
+        storage.autoPartitionRequests = autorequests
fbcaed
-- 
fbcaed
1.9.3
fbcaed