[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Handle lv device and format resizes correctly (#681597)



This fixes up a problem introduced with commit 758add3b, where resizing
an existing logical volume may not cause a subsequent format resize
action to be scheduled.
---
 iw/lvm_dialog_gui.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 0e86edf..f11f194 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -1173,12 +1173,21 @@ class VolumeGroupEditor:
                         usedev.format.migrate = format.migrate
                         actions.append(ActionMigrateFormat(usedev))
 
+                    # check for a device resize action for this lv
+                    subactions = filter(lambda x: x.isResize() and \
+                                            x.isDevice() and \
+                                            hasattr(x.device, "name") and \
+                                            lv.name.endswith(x.device.name),
+                                        actions)
+                    haveDeviceResizeAction = False
+                    if len(subactions) > 0:
+                        haveDeviceResizeAction = True
+
                     # check the lv's format also, explicitly, in case it is
                     # encrypted. in this case we must check them both.
                     if format.resizable and lv.format.resizable and \
                             lv.targetSize != format.targetSize and \
-                            lv.targetSize != lv.currentSize and \
-                            usedev.format.exists:
+                            haveDeviceResizeAction and usedev.format.exists:
                         log.debug("resizing format on %s to %d" % (usedev.lvname, lv.targetSize))
                         actions.append(ActionResizeFormat(usedev, lv.targetSize))
                 elif lv.format.type:
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]