Remove SWRaid method as it is no longer needed (#678379)
Active Linux software RAID devices are detected in the Proc_Partitions_Info method. Hence the SWRaid method is no longer required. Removal of the SWRaid method fixes the problem with the error message: Could not stat device /dev/md/0 - No such file or directory This fixes the problem because we no longer use "mdadm --examine --scan" in an attempt to detect Linux software RAID devices. The mdadm command was returning device names such as /dev/md/0, which are incorrect for GParted. NOTE: With this change, GParted no longer requires the mdadm command to detect Linux software RAID devices. Closes Bug #678379 - Could not stat device /dev/md/0 - No such file or directory
This commit is contained in:
parent
c600095912
commit
de99c530d4
4
README
4
README
|
@ -149,10 +149,6 @@ Optional packages include:
|
||||||
package before that.
|
package before that.
|
||||||
|
|
||||||
|
|
||||||
For Linux software RAID support, the following package is required:
|
|
||||||
mdadm - tool to administer Linux MD arrays
|
|
||||||
|
|
||||||
|
|
||||||
For dmraid support, the following packages are required:
|
For dmraid support, the following packages are required:
|
||||||
|
|
||||||
dmsetup - removes /dev/mapper entries
|
dmsetup - removes /dev/mapper entries
|
||||||
|
|
|
@ -34,7 +34,6 @@ EXTRA_DIST = \
|
||||||
OperationLabelPartition.h \
|
OperationLabelPartition.h \
|
||||||
Partition.h \
|
Partition.h \
|
||||||
Proc_Partitions_Info.h \
|
Proc_Partitions_Info.h \
|
||||||
SWRaid.h \
|
|
||||||
TreeView_Detail.h \
|
TreeView_Detail.h \
|
||||||
Utils.h \
|
Utils.h \
|
||||||
Win_GParted.h \
|
Win_GParted.h \
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
/* Copyright (C) 2009 Curtis Gedak
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* READ THIS!
|
|
||||||
* This class was created in an effort to reduce the complexity of the
|
|
||||||
* GParted_Core class.
|
|
||||||
* This class provides support for Linux software RAID devices (mdadm).
|
|
||||||
* Static elements are used in order to reduce the disk accesses required to
|
|
||||||
* load the data structures upon each initialization of the class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SWRAID_H_
|
|
||||||
#define SWRAID_H_
|
|
||||||
|
|
||||||
#include "../include/Utils.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace GParted
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class SWRaid
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SWRaid() ;
|
|
||||||
SWRaid( const bool & do_refresh ) ;
|
|
||||||
~SWRaid() ;
|
|
||||||
bool is_swraid_supported() ;
|
|
||||||
void get_devices( std::vector<Glib::ustring> & swraid_devices ) ;
|
|
||||||
private:
|
|
||||||
void load_swraid_cache() ;
|
|
||||||
void set_commands_found() ;
|
|
||||||
static bool swraid_cache_initialized ;
|
|
||||||
static bool mdadm_found ;
|
|
||||||
static std::vector<Glib::ustring> swraid_devices ;
|
|
||||||
};
|
|
||||||
|
|
||||||
}//GParted
|
|
||||||
|
|
||||||
#endif /* SWRAID_H_ */
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include "../include/Win_GParted.h"
|
#include "../include/Win_GParted.h"
|
||||||
#include "../include/GParted_Core.h"
|
#include "../include/GParted_Core.h"
|
||||||
#include "../include/DMRaid.h"
|
#include "../include/DMRaid.h"
|
||||||
#include "../include/SWRaid.h"
|
|
||||||
#include "../include/FS_Info.h"
|
#include "../include/FS_Info.h"
|
||||||
#include "../include/LVM2_PV_Info.h"
|
#include "../include/LVM2_PV_Info.h"
|
||||||
#include "../include/OperationCopy.h"
|
#include "../include/OperationCopy.h"
|
||||||
|
@ -144,7 +143,6 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
|
||||||
Proc_Partitions_Info pp_info( true ) ; //Refresh cache of proc partition information
|
Proc_Partitions_Info pp_info( true ) ; //Refresh cache of proc partition information
|
||||||
FS_Info fs_info( true ) ; //Refresh cache of file system information
|
FS_Info fs_info( true ) ; //Refresh cache of file system information
|
||||||
DMRaid dmraid( true ) ; //Refresh cache of dmraid device information
|
DMRaid dmraid( true ) ; //Refresh cache of dmraid device information
|
||||||
SWRaid swraid( true ) ; //Refresh cache of swraid device information
|
|
||||||
LVM2_PV_Info lvm2_pv_info( true ) ; //Refresh cache of LVM2 PV information
|
LVM2_PV_Info lvm2_pv_info( true ) ; //Refresh cache of LVM2 PV information
|
||||||
|
|
||||||
init_maps() ;
|
init_maps() ;
|
||||||
|
@ -171,16 +169,6 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
|
||||||
ped_device_get( temp_devices[ k ] .c_str() ) ;
|
ped_device_get( temp_devices[ k ] .c_str() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Try to find all swraid devices
|
|
||||||
if (swraid .is_swraid_supported() ) {
|
|
||||||
std::vector<Glib::ustring> swraid_devices ;
|
|
||||||
swraid .get_devices( swraid_devices ) ;
|
|
||||||
for ( unsigned int k=0; k < swraid_devices .size(); k++ ) {
|
|
||||||
set_thread_status_message( String::ucompose ( _("Scanning %1"), swraid_devices[k] ) ) ;
|
|
||||||
ped_device_get( swraid_devices[k] .c_str() ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Try to find all dmraid devices
|
//Try to find all dmraid devices
|
||||||
if (dmraid .is_dmraid_supported() ) {
|
if (dmraid .is_dmraid_supported() ) {
|
||||||
std::vector<Glib::ustring> dmraid_devices ;
|
std::vector<Glib::ustring> dmraid_devices ;
|
||||||
|
|
|
@ -44,7 +44,6 @@ gpartedbin_SOURCES = \
|
||||||
OperationLabelPartition.cc \
|
OperationLabelPartition.cc \
|
||||||
Partition.cc \
|
Partition.cc \
|
||||||
Proc_Partitions_Info.cc \
|
Proc_Partitions_Info.cc \
|
||||||
SWRaid.cc \
|
|
||||||
TreeView_Detail.cc \
|
TreeView_Detail.cc \
|
||||||
Utils.cc \
|
Utils.cc \
|
||||||
Win_GParted.cc \
|
Win_GParted.cc \
|
||||||
|
|
104
src/SWRaid.cc
104
src/SWRaid.cc
|
@ -1,104 +0,0 @@
|
||||||
/* Copyright (C) 2009 Curtis Gedak
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../include/SWRaid.h"
|
|
||||||
|
|
||||||
namespace GParted
|
|
||||||
{
|
|
||||||
|
|
||||||
//Initialize static data elements
|
|
||||||
bool SWRaid::swraid_cache_initialized = false ;
|
|
||||||
bool SWRaid::mdadm_found = false ;
|
|
||||||
std::vector<Glib::ustring> SWRaid::swraid_devices ;
|
|
||||||
|
|
||||||
SWRaid::SWRaid()
|
|
||||||
{
|
|
||||||
//Ensure that cache has been loaded at least once
|
|
||||||
if ( ! swraid_cache_initialized )
|
|
||||||
{
|
|
||||||
swraid_cache_initialized = true ;
|
|
||||||
set_commands_found() ;
|
|
||||||
load_swraid_cache() ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SWRaid::SWRaid( const bool & do_refresh )
|
|
||||||
{
|
|
||||||
//Ensure that cache has been loaded at least once
|
|
||||||
if ( ! swraid_cache_initialized )
|
|
||||||
{
|
|
||||||
swraid_cache_initialized = true ;
|
|
||||||
set_commands_found() ;
|
|
||||||
if ( do_refresh == false )
|
|
||||||
load_swraid_cache() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( do_refresh )
|
|
||||||
load_swraid_cache() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
SWRaid::~SWRaid()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SWRaid::load_swraid_cache()
|
|
||||||
{
|
|
||||||
//Load data into swraid structures
|
|
||||||
Glib::ustring output, error ;
|
|
||||||
swraid_devices .clear() ;
|
|
||||||
|
|
||||||
if ( mdadm_found )
|
|
||||||
{
|
|
||||||
if ( ! Utils::execute_command( "mdadm --examine --scan", output, error, true ) )
|
|
||||||
{
|
|
||||||
if ( output .size() > 0 )
|
|
||||||
{
|
|
||||||
std::vector<Glib::ustring> temp_arr ;
|
|
||||||
Utils::tokenize( output, temp_arr, "\n" ) ;
|
|
||||||
for ( unsigned int k = 0; k < temp_arr .size(); k++ )
|
|
||||||
{
|
|
||||||
Glib::ustring temp = Utils::regexp_label( temp_arr[k], "^[^/]*(/dev/[^\t ]*)" ) ;
|
|
||||||
if ( temp .size() > 0 )
|
|
||||||
swraid_devices .push_back( temp ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SWRaid::set_commands_found()
|
|
||||||
{
|
|
||||||
//Set status of commands found
|
|
||||||
mdadm_found = (! Glib::find_program_in_path( "mdadm" ) .empty() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SWRaid::is_swraid_supported()
|
|
||||||
{
|
|
||||||
//Determine if Linux software RAID is supported
|
|
||||||
return ( mdadm_found ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SWRaid::get_devices( std::vector<Glib::ustring> & device_list )
|
|
||||||
{
|
|
||||||
//Retrieve list of Linux software RAID devices
|
|
||||||
device_list .clear() ;
|
|
||||||
|
|
||||||
for ( unsigned int k=0; k < swraid_devices .size(); k++ )
|
|
||||||
device_list .push_back( swraid_devices[k] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}//GParted
|
|
Loading…
Reference in New Issue