[PATCH] add reclaim capability for btrfs subvolumes

Gene Czarcinski gene at czarc.net
Tue Oct 29 15:32:50 UTC 2013


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 custon 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 e6ed38d..53d4dd4 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -387,6 +387,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.destoryDevice(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,
-- 
1.8.3.1



More information about the anaconda-patches mailing list