[PATCH 3/5][blivet] Handle passing a btrfs volume as device to BTRFSFactory.

David Lehman dlehman at redhat.com
Fri Nov 22 16:00:09 UTC 2013


Normally the volume is a container, but it is possible that it has
a mountpoint associated with it, which means it could be passed as
the device in that case.

Related: rhbz#1016959
---
 blivet/devicefactory.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index 4c95709..50362c1 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -404,6 +404,8 @@ class DeviceFactory(object):
                 container = device.vg
             elif hasattr(device, "volume"):
                 container = device.volume
+            elif hasattr(device, "subvolumes"):
+                container = device
         elif name:
             for c in self.storage.devices:
                 if c.name == name and c in self.container_list:
@@ -1641,3 +1643,12 @@ class BTRFSFactory(DeviceFactory):
     def _set_name(self):
         super(BTRFSFactory, self)._set_name()
         self.device.format.options = "subvol=" + self.device.name
+
+    def _reconfigure_device(self):
+        if self.device == self.container:
+            # This is a btrfs volume -- the only thing not handled already is
+            # updating the mountpoint.
+            self.device.format.mountpoint = self.mountpoint
+            return
+
+        super(BTRFSFactory, self)._reconfigure_device()
-- 
1.8.1.4



More information about the anaconda-patches mailing list