[PATCH] Add support for reserved space in volume group.

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

 



reserved-space is an amount to reserve in MB
reserved-percent is a percentage to reserve

Related: rhbz#663647
---
 pykickstart/commands/volgroup.py |   36 ++++++++++++++++++++++++++++++++----
 pykickstart/handlers/control.py  |    4 ++--
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/pykickstart/commands/volgroup.py b/pykickstart/commands/volgroup.py
index 255c47f..64acebe 100644
--- a/pykickstart/commands/volgroup.py
+++ b/pykickstart/commands/volgroup.py
@@ -39,10 +39,8 @@ class FC3_VolGroupData(BaseData):
     def __eq__(self, y):
         return self.vgname == y.vgname
 
-    def __str__(self):
-        retval = BaseData.__str__(self)
-        retval += "volgroup %s" % self.vgname
-
+    def _getArgsAsStr(self):
+        retval = ""
         if not self.format:
             retval += " --noformat"
         if self.pesize != 0:
@@ -50,8 +48,29 @@ class FC3_VolGroupData(BaseData):
         if self.preexist:
             retval += " --useexisting"
 
+        return retval
+
+    def __str__(self):
+        retval = BaseData.__str__(self)
+        retval += "volgroup %s" % self.vgname
+        retval += self._getArgsAsStr()
         return retval + " " + " ".join(self.physvols) + "\n"
 
+class FC16_VolGroupData(FC3_VolGroupData):
+    def __init__(self, *args, **kwargs):
+        FC3_VolGroupData.__init__(self, *args, **kwargs)
+        self.reserved_space = kwargs.get("reserved-space", 0)
+        self.reserved_percent = kwargs.get("reserved-percent", 0)
+
+    def _getArgsAsStr(self):
+        retval = FC3_VolGroupData._getArgsAsStr(self)
+        if self.reserved_space > 0:
+            retval += " --reserved-space=%d" % self.reserved_space
+        if self.reserved_percent > 0:
+            retval += " --reserved-percent=%d" % self.reserved_percent
+
+        return retval
+
 class FC3_VolGroup(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -100,3 +119,12 @@ class FC3_VolGroup(KickstartCommand):
 
     def dataList(self):
         return self.vgList
+
+class FC16_VolGroup(FC3_VolGroup):
+    def _getParser(self):
+        op = FC3_VolGroup._getParser(self)
+        op.add_option("--reserved-space", dest="reserved_space", type="int",
+                      nargs=1, default=0)
+        op.add_option("--reserved-percent", dest="reserved_percent", type="int",
+                      nargs=1, default=0)
+        return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index d8c8f2b..9bfdffc 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -817,7 +817,7 @@ commandMap = {
         "url": method.F14_Method,
         "user": user.F12_User,
         "vnc": vnc.F9_Vnc,
-        "volgroup": volgroup.FC3_VolGroup,
+        "volgroup": volgroup.FC16_VolGroup,
         "xconfig": xconfig.F14_XConfig,
         "zerombr": zerombr.F9_ZeroMbr,
         "zfcp": zfcp.F14_ZFCP,
@@ -1251,7 +1251,7 @@ dataMap = {
         "RepoData": repo.F15_RepoData,
         "SshPwData": sshpw.F13_SshPwData,
         "UserData": user.F12_UserData,
-        "VolGroupData": volgroup.FC3_VolGroupData,
+        "VolGroupData": volgroup.FC16_VolGroupData,
         "ZFCPData": zfcp.F14_ZFCPData,
     },
     RHEL3: {
-- 
1.7.3.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux