Display list of Logical Volumes in the Partition Information dialog (754649)
Bug 754649 - Display Logical Volumes in Volume Group of LVM2 Partition
This commit is contained in:
parent
d4a8e21578
commit
9e950e89b4
|
@ -57,6 +57,7 @@ public:
|
|||
static bool has_active_lvs( const Glib::ustring & path );
|
||||
static bool is_vg_exported( const Glib::ustring & vgname );
|
||||
static std::vector<Glib::ustring> get_vg_members( const Glib::ustring & vgname );
|
||||
static std::vector<Glib::ustring> get_vg_lvs( const Glib::ustring & vgname );
|
||||
static std::vector<Glib::ustring> get_error_messages( const Glib::ustring & path );
|
||||
private:
|
||||
static void initialize_if_required();
|
||||
|
|
|
@ -414,6 +414,26 @@ void Dialog_Partition_Info::Display_Info()
|
|||
table ->attach( * Utils::mk_label( members_str, true, false, true, 0.0 /* ALIGN_TOP */ ), 2, 3, top++, bottom++, Gtk::FILL ) ;
|
||||
}
|
||||
|
||||
if ( partition.filesystem == FS_LVM2_PV )
|
||||
{
|
||||
//Logical Volumes
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Logical Volumes:") ) + "</b>", true, false, false, 0.0 /* ALIGN_TOP */ ),
|
||||
1, 2, top, bottom, Gtk::FILL );
|
||||
|
||||
std::vector<Glib::ustring> lvs;
|
||||
lvs = LVM2_PV_Info::get_vg_lvs( vgname );
|
||||
|
||||
Glib::ustring lvs_str = "";
|
||||
for ( unsigned int i = 0 ; i < lvs .size() ; i ++ )
|
||||
{
|
||||
if ( i > 0 )
|
||||
lvs_str += "\n";
|
||||
lvs_str += lvs[i];
|
||||
}
|
||||
|
||||
table ->attach( * Utils::mk_label( lvs_str, true, false, true, 0.0 /* ALIGN_TOP */ ), 2, 3, top++, bottom++, Gtk::FILL );
|
||||
}
|
||||
|
||||
//Right field & value pair area
|
||||
if ( partition .sector_usage_known() )
|
||||
{
|
||||
|
|
|
@ -152,6 +152,28 @@ std::vector<Glib::ustring> LVM2_PV_Info::get_vg_members( const Glib::ustring & v
|
|||
return members ;
|
||||
}
|
||||
|
||||
// Return vector of LVs in the VG.
|
||||
std::vector<Glib::ustring> LVM2_PV_Info::get_vg_lvs( const Glib::ustring & vgname )
|
||||
{
|
||||
initialize_if_required();
|
||||
std::vector<Glib::ustring> lvs;
|
||||
|
||||
if ( vgname == "" )
|
||||
return lvs;
|
||||
|
||||
for ( unsigned int i = 0 ; i < lvm2_vg_cache.size() ; i ++ )
|
||||
{
|
||||
if ( vgname == lvm2_vg_cache[i].vg_name && lvm2_vg_cache[i].lv_name != "" )
|
||||
{
|
||||
// Only append lv_name if not already in lvs
|
||||
if ( std::find( lvs.begin(), lvs.end(), lvm2_vg_cache[i].lv_name ) == lvs.end() )
|
||||
lvs.push_back( lvm2_vg_cache[i].lv_name );
|
||||
}
|
||||
}
|
||||
|
||||
return lvs;
|
||||
}
|
||||
|
||||
std::vector<Glib::ustring> LVM2_PV_Info::get_error_messages( const Glib::ustring & path )
|
||||
{
|
||||
initialize_if_required() ;
|
||||
|
|
Loading…
Reference in New Issue