I was originally going to reply on the patches list but this is more appropriately a discussion so I am moving it over to the discussion list.
This is the reason for all my agony over testing.
On 10/31/2013 08:13 AM, Gene Czarcinski wrote:
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.
NOTE: While I believe that these two patches are good. However, they have been only partially tested due to problems with pungi/lorax creating ISOs with working BTRFS!
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(+)
OK, now that I understand how to create an updates image which includes anaconda changes AND pykickstart updates, I have conducted some additional tests. I have been testing on Fedora 19 although the submitted patches are for Fedora 20 ... they rebase easily enough.
The problem: storage.destroyDevice(device) gets an "Attribute error: Blivet object has no attrribute 'destroyDevice'
Now, I had done some testing with just anaconda by kluging things up. I changed the if self.preexist: to be if self.preexist and self.mountpoint != "/":
and then were I now have: if self.reclam: I then had if self.preexist:
The point being that the storager.destoryDevice(device) was the same and I traced it going to destoryDevice() in blivet/__init__ around line 1172.
The two patches are below. What is different? This is driving me nuts.
------------------ The Fedora 19 kluge ----------------------------- diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 5bcad3d..287d6c1 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -343,7 +343,9 @@ 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 not self.format: # --noformat + # FIXME: The following hack only exists until pykickstart can be updated to separate + # --noformat and --useexisting into separate parameters so they can have different meanings + if not self.format and self.mountpoint != "/": # --noformat if not self.subvol: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specifying btrfs command for existing volume %s invalid" % self.name)
@@ -368,6 +370,16 @@ class BTRFSData(commands.btrfs.F17_BTRFSData): except KeyError: pass
+ # Handle pre-existing subvol to be deleted + if self.subvol: + device = devicetree.getDeviceByName(self.name) + if device: + if self.preexist: + storage.destroyDevice(device) + log.info("As requested by specified --useexisting, destroying existing BTRFS subvolume %s" % self.name) + else: + raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified BTRFS subvolume %s already exists, specify --useexisting to recreate" % self.name) + request = storage.newBTRFS(name=name, subvol=self.subvol, mountpoint=self.mountpoint,
anaconda-devel@lists.stg.fedoraproject.org