This patch adds the capability to reclaim the name and space of an existing btrfs subvolume and then reuse (recreate) that subvolume. This implements a capability currently available when using non-kickstart custom configuration installs.
This modification requires a change to the pykickstart package which adds the --reclaim option to the btrfs command. --- pyanaconda/kickstart.py | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 504ed59..e490bbb 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -391,6 +391,14 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
device.format.mountpoint = self.mountpoint else: + if self.subvol: + device = devicetree.getDeviceByName(self.name) + if device: + if self.reclaim: + storage.destroyDevice(device) + log.info("As requested by specified --reclaim, destroying existing BTRFS subvolume %s" % self.name) + else: + raise KickstartValueError(formatErrorMsg("Specified BTRFS subvolume %s already exists" % self.name)) request = storage.newBTRFS(name=name, subvol=self.subvol, mountpoint=self.mountpoint,