Display busy status of LVM2 PVs (#160787)
A Volume Group is active when any of its Logical Volume mappings are loaded (and enabled) in the Kernel's device-mapper driver. Therefore all the Physical Volumes in the VG (must be considered) active too. This is exactly equivalent to a mounted file system, as the kernel is actively using the partition. Mark active LVM2 PVs as busy in GParted. Don't use statvfs() for determining sector usage of busy LVM2 PVs as it will fail with "statvfs(VGNAME): No such file or directory". Instead always use the LVM2 PV specific method. Display the status of the LVM2 PV in the Information dialog using one of the following relevant messages: Not active (Not part of any volume group) VGNAME not active VGNAME active (The code uses the VGNAME stored in the partition's first mount point, as displayed in the "Mount Point" column, rather than going back to the primary source of the information in the LVM2_PV_Info class). Temporarily prevent GParted from offering to unmount LVM2 PVs until activating and deactivating Volume Groups is implemented later. Bug #160787 - lvm support
This commit is contained in:
parent
8083f11d84
commit
aa085a3caa
|
@ -266,6 +266,14 @@ void Dialog_Partition_Info::Display_Info()
|
||||||
*/
|
*/
|
||||||
str_temp = _("Active") ;
|
str_temp = _("Active") ;
|
||||||
}
|
}
|
||||||
|
else if ( partition .filesystem == FS_LVM2_PV )
|
||||||
|
{
|
||||||
|
/* TO TRANSLATORS: myvgname active
|
||||||
|
* means that the partition is part of an LVM volume group and that
|
||||||
|
* volume group is active and being used by the operating system.
|
||||||
|
*/
|
||||||
|
str_temp = String::ucompose( _("%1 active"), partition .get_mountpoint() ) ;
|
||||||
|
}
|
||||||
else if ( partition .get_mountpoints() .size() )
|
else if ( partition .get_mountpoints() .size() )
|
||||||
{
|
{
|
||||||
str_temp = String::ucompose(
|
str_temp = String::ucompose(
|
||||||
|
@ -290,6 +298,23 @@ void Dialog_Partition_Info::Display_Info()
|
||||||
*/
|
*/
|
||||||
str_temp = _("Not active") ;
|
str_temp = _("Not active") ;
|
||||||
}
|
}
|
||||||
|
else if ( partition .filesystem == FS_LVM2_PV )
|
||||||
|
{
|
||||||
|
Glib::ustring mount_point = partition .get_mountpoint() ;
|
||||||
|
if ( mount_point .empty() )
|
||||||
|
/* TO TRANSLATORS: Not active (Not part of any volume group)
|
||||||
|
* means that the partition is not yet part of an LVM volume
|
||||||
|
* group and therefore is not active and can not yet be used by
|
||||||
|
* the operating system.
|
||||||
|
*/
|
||||||
|
str_temp = _("Not active (Not part of any volume group)") ;
|
||||||
|
else
|
||||||
|
/* TO TRANSLATORS: myvgname not active
|
||||||
|
* means that the partition is part of an LVM volume group but
|
||||||
|
* the volume group is not active and not being used by the operating system.
|
||||||
|
*/
|
||||||
|
str_temp = String::ucompose( _("%1 not active"), mount_point ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* TO TRANSLATORS: Not mounted
|
/* TO TRANSLATORS: Not mounted
|
||||||
|
|
|
@ -906,6 +906,7 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
#ifndef USE_LIBPARTED_DMRAID
|
#ifndef USE_LIBPARTED_DMRAID
|
||||||
DMRaid dmraid ; //Use cache of dmraid device information
|
DMRaid dmraid ; //Use cache of dmraid device information
|
||||||
#endif
|
#endif
|
||||||
|
LVM2_PV_Info lvm2_pv_info ;
|
||||||
|
|
||||||
//clear partitions
|
//clear partitions
|
||||||
device .partitions .clear() ;
|
device .partitions .clear() ;
|
||||||
|
@ -941,7 +942,8 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
partition_is_busy = ped_partition_is_busy( lp_partition ) ||
|
||||||
|
lvm2_pv_info .has_active_lvs( partition_path ) ;
|
||||||
|
|
||||||
partition_temp .Set( device .get_path(),
|
partition_temp .Set( device .get_path(),
|
||||||
partition_path,
|
partition_path,
|
||||||
|
@ -983,7 +985,8 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
partition_is_busy = ped_partition_is_busy( lp_partition ) ||
|
||||||
|
lvm2_pv_info .has_active_lvs( partition_path ) ;
|
||||||
|
|
||||||
partition_temp .Set( device .get_path(),
|
partition_temp .Set( device .get_path(),
|
||||||
partition_path,
|
partition_path,
|
||||||
|
@ -1433,7 +1436,7 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
|
||||||
if ( partitions[ t ] .type == GParted::TYPE_PRIMARY ||
|
if ( partitions[ t ] .type == GParted::TYPE_PRIMARY ||
|
||||||
partitions[ t ] .type == GParted::TYPE_LOGICAL )
|
partitions[ t ] .type == GParted::TYPE_LOGICAL )
|
||||||
{
|
{
|
||||||
if ( partitions[ t ] .busy )
|
if ( partitions[ t ] .busy && partitions[t] .filesystem != GParted::FS_LVM2_PV )
|
||||||
{
|
{
|
||||||
if ( partitions[ t ] .get_mountpoints() .size() > 0 )
|
if ( partitions[ t ] .get_mountpoints() .size() > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -941,7 +941,8 @@ void Win_GParted::set_valid_operations()
|
||||||
//only unmount is allowed (if ! extended)
|
//only unmount is allowed (if ! extended)
|
||||||
if ( selected_partition .busy )
|
if ( selected_partition .busy )
|
||||||
{
|
{
|
||||||
if ( selected_partition .type != GParted::TYPE_EXTENDED )
|
if ( selected_partition .type != GParted::TYPE_EXTENDED &&
|
||||||
|
selected_partition .filesystem != GParted::FS_LVM2_PV )
|
||||||
allow_toggle_swap_mount_state( true ) ;
|
allow_toggle_swap_mount_state( true ) ;
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
|
|
Loading…
Reference in New Issue