[PATCH atomic rhel7-branch] atomic: set up atomic specific partitioning defaults
Radek Vykydal
rvykydal at redhat.com
Tue Oct 21 12:49:34 UTC 2014
/boot will be 300M and / LV will be 3G. LVs for docker will be created by special
service using root's VG.
I'm not happy about this patch. It says what I want to achieve, but
as for the implementation...
* I didn't find reasonable way to inherit RHEL Atomic installclass from
rhel.py InstallClass.
* I didn't want to create rhel-atomic.py copying stuff from rhel.py and
doing the modifications (code duplication). Or do you think it would
be cleaner? Thinking of it now, it would be probably better start for
consolidating installclasses later.
* I didn't feel like updating the machanism of collecting installclasses
so we could inherit Atomic from RHEL class (eg creating AtomicInstallClass
inheriting from InstallClass in rhel.py and collecting *InstallClass objects
from rhel.py). This is kind of short-term solution because well, atomic.
----
pyanaconda/installclasses/rhel.py | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
index de5608d..917582c 100644
--- a/pyanaconda/installclasses/rhel.py
+++ b/pyanaconda/installclasses/rhel.py
@@ -23,6 +23,10 @@ from pyanaconda import network
from pyanaconda import nm
from pyanaconda import iutil
from pyanaconda.i18n import N_
+from pyanaconda.kickstart import getAvailableDiskSpace
+from blivet.partspec import *
+from blivet.platform import platform
+from blivet.devicelibs import swap
class InstallClass(BaseInstallClass):
# name has underscore used for mnemonics, strip if you dont need it
@@ -31,6 +35,7 @@ class InstallClass(BaseInstallClass):
sortPriority = 20000
if not productName.startswith(("Red Hat ", "RHEL Atomic")):
hidden = 1
+ atomic = productName.startswith("RHEL Atomic ")
defaultFS = "xfs"
bootloaderTimeoutDefault = 5
@@ -47,9 +52,35 @@ class InstallClass(BaseInstallClass):
help_placeholder = "RHEL7Placeholder.html"
help_placeholder_with_links = "RHEL7PlaceholderWithLinks.html"
+ def setDefaultPartitioning(self, storage):
+ if self.atomic:
+ autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType,
+ size=1024, maxSize=3*1024, grow=True, lv=True)]
+
+ bootreqs = platform.setDefaultPartitioning()
+ if bootreqs:
+ autorequests.extend(bootreqs)
+
+ disk_space = getAvailableDiskSpace(storage)
+ swp = swap.swapSuggestion(disk_space=disk_space)
+ autorequests.append(PartSpec(fstype="swap", size=swp, grow=False,
+ lv=True, encrypted=True))
+
+ for autoreq in autorequests:
+ if autoreq.fstype is None:
+ if autoreq.mountpoint == "/boot":
+ autoreq.fstype = storage.defaultBootFSType
+ autoreq.size = 300
+ else:
+ autoreq.fstype = storage.defaultFSType
+
+ storage.autoPartitionRequests = autorequests
+ else:
+ BaseInstallClass.setDefaultPartitioning(self, storage)
+
def configure(self, anaconda):
BaseInstallClass.configure(self, anaconda)
- BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
+ self.setDefaultPartitioning(anaconda.storage)
# Set first boot policy regarding ONBOOT value
# (i.e. which network devices should be activated automatically after reboot)
--
1.9.3
More information about the anaconda-patches
mailing list