Add support for resizing block devices via kickstart.
logvol and partition get a new option, --resize. It must be combined
with --size=<newsize> and either --onpart or --useexisting.
---
pyanaconda/kickstart.py | 53 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 5167d1f..e870f97 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -524,7 +524,7 @@ class Lang(commands.lang.FC3_Lang):
self.anaconda.instLanguage.buildLocale()
self.anaconda.dispatch.skip_steps("language")
-class LogVolData(commands.logvol.F15_LogVolData):
+class LogVolData(commands.logvol.F17_LogVolData):
def execute(self):
storage = self.anaconda.storage
devicetree = storage.devicetree
@@ -562,6 +562,23 @@ class LogVolData(commands.logvol.F15_LogVolData):
if not dev:
raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting logical volume with the name "%s" was found." % self.name)
removeExistingFormat(device, storage)
+
+ if self.resize:
+ try:
+ devicetree.registerAction(ActionResizeDevice(devic e, self.size))
+ except ValueError:
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg="Invalid target size (%d) for device %s" % (self.size, device.name)))
+
devicetree.registerAction(ActionCreateFormat(devic e, format))
else:
# If a previous device has claimed this mount point, delete the
@@ -795,7 +820,7 @@ class DmRaid(commands.dmraid.FC6_DmRaid):
def parse(self, args):
raise NotImplementedError("The dmraid kickstart command is not currently supported")
-class PartitionData(commands.partition.F12_PartData):
+class PartitionData(commands.partition.F17_PartData):
def execute(self):
storage = self.anaconda.storage
devicetree = storage.devicetree
@@ -892,6 +917,23 @@ class PartitionData(commands.partition.F12_PartData):
if not dev:
raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting partition with the name "%s" was found." % self.onPart)
removeExistingFormat(device, storage)
+ if self.resize:
+ try:
+ devicetree.registerAction(ActionResizeDevice(devic e, self.size))
+ except ValueError:
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg="Invalid target size (%d) for device %s" % (self.size, device.name)))
+
devicetree.registerAction(ActionCreateFormat(devic e, kwargs["format"]))
else:
# If a previous device has claimed this mount point, delete the
--
1.7.7.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list