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.
This commit is contained in:
Mike Fleetwood 2016-08-19 11:36:48 +01:00 committed by Curtis Gedak
parent 2740113dcb
commit 683b4da0e4
1 changed files with 7 additions and 12 deletions

View File

@ -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 ) ;