[PATCH 14/17] Special treatment for getting parted device for old-style lvm snapshots.

David Lehman dlehman at redhat.com
Thu Jun 5 16:47:34 UTC 2014


The device at the obvious path shows the same size as the origin, which
is not necessarily the size of the snapshot. This special device with
"-cow" appended to it seems to show the correct size.
---
 blivet/devices.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/blivet/devices.py b/blivet/devices.py
index 4df633d..8eec9a6 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -657,17 +657,21 @@ class StorageDevice(Device):
 
         return crypted
 
+    def _getPartedDevicePath(self):
+        return self.path
+
     @property
     def partedDevice(self):
+        devicePath = self._getPartedDevicePath()
         if self.exists and self.status and not self._partedDevice:
-            log.debug("looking up parted Device: %s", self.path)
+            log.debug("looking up parted Device: %s", devicePath)
 
             # We aren't guaranteed to be able to get a device.  In
             # particular, built-in USB flash readers show up as devices but
             # do not always have any media present, so parted won't be able
             # to find a device.
             try:
-                self._partedDevice = parted.Device(path=self.path)
+                self._partedDevice = parted.Device(path=devicePath)
             except (_ped.IOException, _ped.DeviceException):
                 pass
 
@@ -3240,6 +3244,9 @@ class LVMSnapShotDevice(LVMSnapShotBase, LVMLogicalVolumeDevice):
         # that it is okay to remove the active snapshot
         lvm.lvremove(self.vg.name, self._name, force=True)
 
+    def _getPartedDevicePath(self):
+        return "%s-cow" % self.path
+
     def dependsOn(self, dep):
         # pylint: disable=bad-super-call
         return (self.origin == dep or
-- 
1.9.0



More information about the anaconda-patches mailing list