This involves a patch to pykickstart and a patch to anaconda.
The patch for anaconda was created on anaconda-20.25.4-1 and the patch
for pykickstart was created on r-1.99.44-1 and should easily apply or
rebase.
The patches implement a capability currently available if you perform a
non-kickstart custom-allocation install where you can reclaim the name
(and space) of an existing btrfs subvolume and then reuse (recreate) a
new btrfs subvolume of the smae name over it.
The are times in both virtual and real world when a reinstall is needed.
Currently, when this involves a btrfs subvolume as root, you have to manually
delete that subvolume. The capability implemented in these patches allows
a kickstart user to do that at install time.
Note: "--reclaim" was chosen for the option since it is both different and,
at the same time, the same as the term used in a non-kickstart install.
Gene Czarcinski (1):
add btrfs option reclaim
pykickstart/commands/btrfs.py | 4 ++++
1 file changed, 4 insertions(+)
Gene Czarcinski (1):
add reclaim capability for btrfs subvolumes
pyanaconda/kickstart.py | 8 ++++++++
1 file changed, 8 insertions(+)
--
1.8.3.1
Show replies by date
The btrfs --reclaim option is intended for use with existing
subvolumes where to objective is to reclaim and reuse an
existing subvolume name and space. This will provide
kickstart with capability currently available with non-
kickstart custom allocation installs.
Naturally, full implementation will require code changes
made to anaconda.
---
pykickstart/commands/btrfs.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pykickstart/commands/btrfs.py b/pykickstart/commands/btrfs.py
index 2c263ac..1a2be3a 100644
--- a/pykickstart/commands/btrfs.py
+++ b/pykickstart/commands/btrfs.py
@@ -67,6 +67,8 @@ class F17_BTRFSData(BaseData):
retval += " --metadata=%s" % self.metaDataLevel
if self.subvol:
retval += " --subvol --name=%s" % self.name
+ if self.reclaim:
+ retval += " --reclaim"
return retval
@@ -129,6 +131,8 @@ class F17_BTRFS(KickstartCommand):
#
op.add_option("--subvol", dest="subvol",
action="store_true",
default=False)
+ op.add_option("--reclaim", dest="reclaim",
action="store_true",
+ default=False)
# parent must be a device spec (LABEL, UUID, &c)
op.add_option("--parent", dest="parent",
default="")
--
1.8.3.1
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