diff --git a/include/LVM2_PV_Info.h b/include/LVM2_PV_Info.h index f3edb23f..aa89b8ca 100644 --- a/include/LVM2_PV_Info.h +++ b/include/LVM2_PV_Info.h @@ -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 get_error_messages() ; + std::vector get_error_messages( const Glib::ustring & path ) ; private: void initialize_if_required() ; void set_command_found() ; diff --git a/src/LVM2_PV_Info.cc b/src/LVM2_PV_Info.cc index a882fb50..76ef2571 100644 --- a/src/LVM2_PV_Info.cc +++ b/src/LVM2_PV_Info.cc @@ -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 LVM2_PV_Info::get_error_messages() +std::vector LVM2_PV_Info::get_error_messages( const Glib::ustring & path ) { initialize_if_required() ; - return error_messages ; + if ( ! error_messages .empty() ) + //Return whole cache error messages as first choice + return error_messages ; + + std::vector 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 diff --git a/src/lvm2_pv.cc b/src/lvm2_pv.cc index f1684978..d085a8e5 100644 --- a/src/lvm2_pv.cc +++ b/src/lvm2_pv.cc @@ -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 error_messages = lvm2_pv_info .get_error_messages() ; + std::vector 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 ++ )