When we remove other subvols from the main volume we can use the
requested sizes of the remaining subvols to decide the new size of
the volume.
Related: rhbz#865199
---
pyanaconda/storage/__init__.py | 1 -
pyanaconda/storage/devices.py | 8 ++++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 70e7def..259054f 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1120,7 +1120,6 @@ class Storage(object):
fmt_args["mountopts"] = "subvol=%s" % name
kwargs.pop("metaDataLevel", None)
kwargs.pop("dataLevel", None)
- kwargs.pop("size", None)
else:
dev_class = BTRFSVolumeDevice
# set up the volume label, using hostname if necessary
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index 4134aed..16ea5f0 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -3846,6 +3846,7 @@ class BTRFSDevice(StorageDevice):
if not args or not args[0]:
args = ("btrfs.%d" % Device._id,)
+ self.req_size = kwargs.pop("size", None)
super(BTRFSDevice, self).__init__(*args, **kwargs)
def updateSysfsPath(self):
@@ -3948,6 +3949,13 @@ class BTRFSVolumeDevice(BTRFSDevice):
if label:
self._name = label
+ def _getSize(self):
+ size = sum([d.size for d in self.parents])
+ if self.dataLevel in ("raid1", "raid10"):
+ size /= len(self.parents)
+
+ return size
+
def _addDevice(self, device):
""" Add a new device to this volume.
--
1.7.7.6