Warn when an LVM2 PV is a member of a damaged VG (#160878)
Generate a warning for each LVM2 Physical Volume which is a member of a Volume Group which has other members missing. Bug #160787 - lvm support
This commit is contained in:
parent
6d665d669d
commit
ea1c0c023e
|
@ -42,7 +42,7 @@ public:
|
|||
Byte_Value get_free_bytes( const Glib::ustring & path ) ;
|
||||
bool has_active_lvs( const Glib::ustring & path ) ;
|
||||
bool is_vg_exported( const Glib::ustring & vgname ) ;
|
||||
std::vector<Glib::ustring> get_error_messages() ;
|
||||
std::vector<Glib::ustring> get_error_messages( const Glib::ustring & path ) ;
|
||||
private:
|
||||
void initialize_if_required() ;
|
||||
void set_command_found() ;
|
||||
|
|
|
@ -50,7 +50,8 @@ enum PV_ATTRIBUTE
|
|||
// "/dev/sda13,830472192,GParted_VG3,wz--n-,,",
|
||||
// "/dev/sda14,1828716544,GParted-VG4,wzx-n-,lvol0,-wi---",
|
||||
// "/dev/sda14,1828716544,GParted-VG4,wzx-n-,,"]
|
||||
// error_messages - String vector storing error messsages.
|
||||
// error_messages - String vector storing whole cache error
|
||||
// messsages.
|
||||
|
||||
|
||||
//Initialize static data elements
|
||||
|
@ -157,10 +158,30 @@ bool LVM2_PV_Info::is_vg_exported( const Glib::ustring & vgname )
|
|||
return false ;
|
||||
}
|
||||
|
||||
std::vector<Glib::ustring> LVM2_PV_Info::get_error_messages()
|
||||
std::vector<Glib::ustring> LVM2_PV_Info::get_error_messages( const Glib::ustring & path )
|
||||
{
|
||||
initialize_if_required() ;
|
||||
if ( ! error_messages .empty() )
|
||||
//Return whole cache error messages as first choice
|
||||
return error_messages ;
|
||||
|
||||
std::vector<Glib::ustring> partition_specific_messages ;
|
||||
partition_specific_messages .clear() ;
|
||||
Glib::ustring temp ;
|
||||
|
||||
//Check for partition specific message: partial VG
|
||||
Glib::ustring vg_bits = get_pv_attr_by_path( path, PVATTR_VG_BITS ) ;
|
||||
//4rd "bit" is partial flag. E.g.
|
||||
// "wz--n-" all PVs exist, "wz-pn-" one or move PVs missing.
|
||||
// Treat any non-hyphen character as damaged.
|
||||
if ( vg_bits .length() >= 4 && vg_bits [3] != '-' )
|
||||
{
|
||||
temp = _("One or more Physical Volumes belonging to the Volume Group is missing.") ;
|
||||
temp += "\n" ;
|
||||
partition_specific_messages .push_back ( temp ) ;
|
||||
}
|
||||
|
||||
return partition_specific_messages ;
|
||||
}
|
||||
|
||||
//Private methods
|
||||
|
|
|
@ -43,7 +43,7 @@ void lvm2_pv::set_used_sectors( Partition & partition )
|
|||
if ( free_bytes >= 0 )
|
||||
partition .Set_Unused( Utils::round( double(free_bytes) / double(partition .sector_size) ) ) ;
|
||||
|
||||
std::vector<Glib::ustring> error_messages = lvm2_pv_info .get_error_messages() ;
|
||||
std::vector<Glib::ustring> error_messages = lvm2_pv_info .get_error_messages( partition .get_path() ) ;
|
||||
if ( ! error_messages .empty() )
|
||||
{
|
||||
for ( unsigned int i = 0 ; i < error_messages .size() ; i ++ )
|
||||
|
|
Loading…
Reference in New Issue