Display LVM2 VGNAME as the PV's mount point (#160787)

As the Mount Point column is being borrowed to display the PV's VGNAME,
also suppress generation of the "Mount on" submenu for LVM2 PVs.

Bug #160787 - lvm support
This commit is contained in:
Mike Fleetwood 2011-12-16 21:32:54 +00:00 committed by Curtis Gedak
parent ff8ad04120
commit 8083f11d84
4 changed files with 21 additions and 1 deletions

View file

@ -93,6 +93,7 @@ public:
Sector get_sector_length() const ;
Glib::ustring get_path() const ;
std::vector<Glib::ustring> get_paths() const ;
void add_mountpoint( const Glib::ustring & mountpoint, bool clear_mountpoints = false ) ;
void add_mountpoints( const std::vector<Glib::ustring> & mountpoints, bool clear_mountpoints = false ) ;
Glib::ustring get_mountpoint() const ;
void clear_mountpoints() ;

View file

@ -1346,6 +1346,7 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
#ifndef USE_LIBPARTED_DMRAID
DMRaid dmraid ; //Use cache of dmraid device information
#endif
LVM2_PV_Info lvm2_pv_info ;
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
{
if ( ( partitions[ t ] .type == GParted::TYPE_PRIMARY ||
@ -1409,6 +1410,12 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
}
else if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
set_mountpoints( partitions[ t ] .logicals ) ;
else if ( partitions[ t ] .filesystem == GParted::FS_LVM2_PV )
{
Glib::ustring vgname = lvm2_pv_info. get_vg_name( partitions[t].get_path() ) ;
if ( ! vgname .empty() )
partitions[ t ] .add_mountpoint( vgname ) ;
}
}
}

View file

@ -207,6 +207,14 @@ void Partition::sort_paths_and_remove_duplicates()
std::sort( paths .begin(), paths .end(), compare_paths ) ;
}
void Partition::add_mountpoint( const Glib::ustring & mountpoint, bool clear_mountpoints )
{
if ( clear_mountpoints )
this ->mountpoints .clear() ;
this ->mountpoints .push_back( mountpoint ) ;
}
void Partition::add_mountpoints( const std::vector<Glib::ustring> & mountpoints, bool clear_mountpoints )
{
if ( clear_mountpoints )

View file

@ -1043,7 +1043,11 @@ void Win_GParted::set_valid_operations()
if ( selected_partition .status == GParted::STAT_REAL && fs .write_uuid )
allow_change_uuid( true ) ;
if ( selected_partition .get_mountpoints() .size() )
//Generate Mount on submenu, except for LVM2 PVs
// borrowing mount point to display the VGNAME
if ( selected_partition .filesystem != GParted::FS_LVM2_PV
&& selected_partition .get_mountpoints() .size()
)
{
allow_toggle_swap_mount_state( true ) ;