[gparted] Update LVM2 PV activate/deactivate check in set_valid_operations()



commit 683b4da0e45abf66bb5fe1da926647aaf6003335
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Aug 19 11:36:48 2016 +0100

    Update LVM2 PV activate/deactivate check in set_valid_operations()
    
    Simplify conditions checking whether activate/deactivate of an LVM2 PV
    is possible.  Excluding extended partition type was unnecessary as it
    only matters that the file system type is LVM2 PV or not.
    
    Also remove activate/deactivate from the comment above as that check
    only determines if the busy state of file systems and swap space can be
    toggled.

 src/Win_GParted.cc |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 4759ff9..5103500 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1096,7 +1096,7 @@ void Win_GParted::set_valid_operations()
                                                                   : CTEXT_ACTIVATE_FILESYSTEM )
                                                                  ) ;
 
-       // Only permit mount/unmount, swapon/swapoff, activate/deactivate if action is available
+       // Only permit file system mount/unmount and swapon/swapoff when available
        if (    selected_partition_ptr->status     == STAT_REAL
             && selected_partition_ptr->type       != TYPE_EXTENDED
             && selected_partition_ptr->filesystem != FS_LVM2_PV
@@ -1109,18 +1109,13 @@ void Win_GParted::set_valid_operations()
           )
                allow_toggle_busy_state( true ) ;
 
-       //Only permit VG deactivation if busy, or activation if not busy and a member of a VG.
-       //  For now specifically allow activation of an exported VG, which LVM will fail
-       //  with "Volume group "VGNAME" is exported", otherwise user won't know why the
-       //  inactive PV can't be activated.
+       // Only permit LVM VG activate/deactivate if the PV is busy or a member of a VG.
+       // For now specifically allow activation of an exported VG, which LVM will fail
+       // with "Volume group "VGNAME" is exported", otherwise user won't know why the
+       // inactive PV can't be activated.
        if (    selected_partition_ptr->status     == STAT_REAL
-            && selected_partition_ptr->type       != TYPE_EXTENDED
-            && selected_partition_ptr->filesystem == FS_LVM2_PV
-            && (    selected_partition_ptr->busy
-                 || (    ! selected_partition_ptr->busy
-                      && ! selected_partition_ptr->get_mountpoints().empty()  // VGNAME from mount point
-                    )
-               )
+            && selected_partition_ptr->filesystem == FS_LVM2_PV          // Active VGNAME from mount point
+            && ( selected_partition_ptr->busy || selected_partition_ptr->get_mountpoints().size() > 0 )
           )
                allow_toggle_busy_state( true ) ;
 


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