[master 2/2] Allow resizing of non-leaf partitions
vojtechtrefny
installerbot-noreply at redhat.com
Thu Sep 10 12:48:26 UTC 2015
From: Vojtech Trefny <vtrefny at redhat.com>
Do not run _preDestroy when resizing partitions -- it raises
exception when trying to resize non-leaf partitions (e.g. extended
partition with logical partitions).
---
blivet/devices/partition.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
index 52f219c..3eafc30 100644
--- a/blivet/devices/partition.py
+++ b/blivet/devices/partition.py
@@ -640,7 +640,7 @@ def _computeResize(self, partition, newsize=None):
def resize(self):
log_method_call(self, self.name, status=self.status)
- self._preDestroy()
+ self._preResize()
# partedDisk has been restored to _origPartedDisk, so
# recalculate resize geometry because we may have new
@@ -657,6 +657,17 @@ def resize(self):
self.disk.format.commit()
self.updateSize()
+ def _preResize(self):
+ if not self.exists:
+ raise errors.DeviceError("device has not been created", self.name)
+
+ self.teardown()
+
+ if not self.sysfsPath:
+ return
+
+ self.setupParents(orig=True)
+
def _preDestroy(self):
StorageDevice._preDestroy(self)
if not self.sysfsPath:
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/99c7a9111c9f9f191cd19cb757a37210a1f224e9
More information about the anaconda-patches
mailing list