[PATCH] btrfs allows mounting of non-leaf devices. (#1016959)

David Lehman dlehman at redhat.com
Fri Nov 15 15:00:55 UTC 2013


---
 pyanaconda/ui/gui/spokes/custom.py | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index a463835..e5502ca 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -315,7 +315,7 @@ class ConfirmDeleteDialog(GUIObject):
         self.window.destroy()
 
     # pylint: disable-msg=W0221
-    def refresh(self, mountpoint, device, rootName):
+    def refresh(self, mountpoint, device, rootName, subvols=False):
         GUIObject.refresh(self)
         label = self.builder.get_object("confirmLabel")
 
@@ -332,7 +332,10 @@ class ConfirmDeleteDialog(GUIObject):
         else:
             txt = device
 
-        label_text = _("Are you sure you want to delete all of the data on %s?") % txt
+        if not subvols:
+            label_text = _("Are you sure you want to delete all of the data on %s?") % txt
+        else:
+            label_text = _("Are you sure you want to delete all of the data on %s, including subvolumes and/or snapshots?") % txt
 
         label.set_text(label_text)
 
@@ -799,7 +802,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
     def unusedDevices(self):
         unused_devices = [d for d in self.__storage.unusedDevices
                                 if d.disks and d.mediaPresent and
-                                not d.partitioned and d.isleaf]
+                                not d.partitioned and
+                                (d.isleaf or d.type.startswith("btrfs"))]
         # add incomplete VGs and MDs
         incomplete = [d for d in self.__storage.devicetree._devices
                             if not getattr(d, "complete", True)]
@@ -910,7 +914,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
     @property
     def new_devices(self):
         # A device scheduled for formatting only belongs in the new root.
-        new_devices = [d for d in self._devices if d.isleaf and
+        new_devices = [d for d in self._devices if (d.isleaf or
+                                                    d.type.startswith("btrfs"))
+                                                   and
                                                    not d.format.exists and
                                                    not d.partitioned]
 
@@ -2076,6 +2082,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             try:
                 if device.isDisk:
                     self.__storage.initializeDisk(device)
+                elif device.type.startswith("btrfs") and not device.isleaf:
+                    self.__storage.recursiveRemove(device)
                 else:
                     self.__storage.destroyDevice(device)
             except StorageError as e:
@@ -2189,8 +2197,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             # schedule actions to delete the thing.
             dialog = ConfirmDeleteDialog(self.data)
             with enlightbox(self.window, dialog.window):
+                subvols = (device.type.startswith("btrfs") and
+                           not device.isleaf)
                 dialog.refresh(getattr(device.format, "mountpoint", ""),
-                               device.name, root_name)
+                               device.name, root_name, subvols=subvols)
                 rc = dialog.run()
 
                 if rc != 1:
-- 
1.8.1.4



More information about the anaconda-patches mailing list