[PATCH 1/2] support specifying existing BTRFS subvolumes noformat

Gene Czarcinski gene at czarc.net
Wed Oct 16 14:14:24 UTC 2013


Specifying an existing BTRFS subvolume in a kickstart file
is now supported with --noformat.  When --noformat is
pecified, the BTRFS subvolume will be added to the /etc/fstab
definition with the UUID of the BTRFS parent volume.

The use of --noformat replaces the use of --useexisting although
currently there is no difference.  A test is added just in case
noformat is specified for a BTRFS volume.

This patch was developed against git level anaconda-20-22-1,
built on a Fedora TC1+ system and tested by running
F20-beta-TC2 installation with all repos enabled onto a KVM virtual.
---
 pyanaconda/kickstart.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 381efb4..f364113 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -369,13 +369,20 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
         if self.mountpoint != "" and self.mountpoint[0] != '/':
             raise KickstartValueError(formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (self.mountpoint,)))
 
-        if self.preexist:
+        if not self.format: # --noformat
+            if not self.subvol:
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specifying btrfs command for existing volume %s invalid" % self.name))
+
             device = devicetree.getDeviceByName(self.name)
             if not device:
                 device = udev.udev_resolve_devspec(self.name)
 
             if not device:
                 raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent BTRFS volume %s in btrfs command" % self.name))
+            device.format.mountpoint = self.mountpoint
+            device.format.mountopts = "subvol=%s" % (self.name)
+            device.format.uuid = dev.uuid # use the UUID from the parent (the BTRFS Volume)
+            return
         else:
             # If a previous device has claimed this mount point, delete the
             # old one.
-- 
1.8.3.1



More information about the anaconda-patches mailing list