[gparted] Display list of Logical Volumes in the Partition Information dialog (754649)
- From: Mike Fleetwood <mfleetwo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Display list of Logical Volumes in the Partition Information dialog (754649)
- Date: Tue, 15 Sep 2015 19:12:25 +0000 (UTC)
commit 9e950e89b42158753c47bb846336e83b4bf3c100
Author: Wrolf Courtney <wrolf wrolf net>
Date: Sun Sep 6 15:46:31 2015 -0400
Display list of Logical Volumes in the Partition Information dialog (754649)
Bug 754649 - Display Logical Volumes in Volume Group of LVM2 Partition
include/LVM2_PV_Info.h | 1 +
src/Dialog_Partition_Info.cc | 20 ++++++++++++++++++++
src/LVM2_PV_Info.cc | 22 ++++++++++++++++++++++
3 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/include/LVM2_PV_Info.h b/include/LVM2_PV_Info.h
index c7cc010..25f0e1d 100644
--- a/include/LVM2_PV_Info.h
+++ b/include/LVM2_PV_Info.h
@@ -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();
diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc
index 4f5e167..2cee91c 100644
--- a/src/Dialog_Partition_Info.cc
+++ b/src/Dialog_Partition_Info.cc
@@ -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() )
{
diff --git a/src/LVM2_PV_Info.cc b/src/LVM2_PV_Info.cc
index 2bfa97e..07c676c 100644
--- a/src/LVM2_PV_Info.cc
+++ b/src/LVM2_PV_Info.cc
@@ -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() ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]