mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-08-27 11:40:03 +00:00
Remove get_dmraid_prefix method used to specify a single device
It appears that different dmraid versions handle specifying a single dmraid device differently. dmraid-1.0.0.rc14 uses a partial name only, such as "isw" or "isw_cjbdddajhi". dmriad-1.0.0.rc15 uses a full name only, such as "isw_cjbdddajhi_Vol0". To maintain compatibility with the broadest range of dmraid versions, the ability to specify a single dmraid device is being removed.
This commit is contained in:
parent
3f773c3ae8
commit
2a89d936d6
|
@ -51,7 +51,6 @@ public:
|
|||
int execute_command( const Glib::ustring & command, OperationDetail & operationdetail ) ;
|
||||
void get_devices( std::vector<Glib::ustring> & dmraid_devices ) ;
|
||||
Glib::ustring get_dmraid_name( const Glib::ustring & dev_path ) ;
|
||||
Glib::ustring get_dmraid_prefix( const Glib::ustring & dev_path ) ;
|
||||
int get_partition_number( const Glib::ustring & partition_name ) ;
|
||||
Glib::ustring get_udev_name( const Glib::ustring & dev_path ) ;
|
||||
bool create_dev_map_entries( const Partition & partition, OperationDetail & operationdetail ) ;
|
||||
|
|
|
@ -176,25 +176,6 @@ Glib::ustring DMRaid::get_dmraid_name( const Glib::ustring & dev_path )
|
|||
return dmraid_name ;
|
||||
}
|
||||
|
||||
Glib::ustring DMRaid::get_dmraid_prefix( const Glib::ustring & dev_path )
|
||||
{
|
||||
//Retrieve prefix of dmraid device representing fake RAID manufacturer
|
||||
|
||||
//First try to get longer prefix including underscore to more accurately define the dmraid prefix
|
||||
Glib::ustring dmraid_name = get_dmraid_name( dev_path ) ;
|
||||
Glib::ustring regexp = "^([^_]*_[^_]*)" ;
|
||||
Glib::ustring dmraid_prefix = Utils::regexp_label( dmraid_name, regexp ) ;
|
||||
|
||||
if ( dmraid_prefix .size() <= 0 )
|
||||
{
|
||||
//Retrieve shorter prefix because longer name did not work
|
||||
regexp = "^([^_]*)" ;
|
||||
dmraid_prefix = Utils::regexp_label( dmraid_name, regexp ) ;
|
||||
}
|
||||
|
||||
return dmraid_prefix ;
|
||||
}
|
||||
|
||||
void DMRaid::get_dmraid_dir_entries( const Glib::ustring & dev_path, std::vector<Glib::ustring> & dir_list )
|
||||
{
|
||||
//Build list of all device entries matching device path
|
||||
|
@ -254,8 +235,7 @@ bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetai
|
|||
Glib::ustring tmp = String::ucompose ( _("create missing %1 entries"), DEV_MAP_PATH ) ;
|
||||
operationdetail .add_child( OperationDetail( tmp ) );
|
||||
|
||||
Glib::ustring dmraid_prefix = get_dmraid_prefix( partition .device_path ) ;
|
||||
command = "dmraid -ay -v " + dmraid_prefix ;
|
||||
command = "dmraid -ay -v" ;
|
||||
if ( execute_command( command, operationdetail .get_last_child() ) )
|
||||
exit_status = false ; //command failed
|
||||
|
||||
|
@ -277,13 +257,11 @@ bool DMRaid::create_dev_map_entries( const Glib::ustring & dev_path )
|
|||
Glib::ustring command, output, error ;
|
||||
bool exit_status = true ;
|
||||
|
||||
Glib::ustring dmraid_prefix = get_dmraid_prefix( dev_path ) ;
|
||||
Glib::ustring dmraid_name = get_dmraid_name( dev_path ) ;
|
||||
|
||||
command = "dmraid -ay -v " + dmraid_prefix ;
|
||||
command = "dmraid -ay -v" ;
|
||||
if ( Utils::execute_command( command, output, error, true ) )
|
||||
exit_status = false; //command failed
|
||||
|
||||
Glib::ustring dmraid_name = get_dmraid_name( dev_path ) ;
|
||||
command = "kpartx -a -v " + DEV_MAP_PATH + dmraid_name ;
|
||||
if ( Utils::execute_command( command, output, error, true ) )
|
||||
exit_status = false; //command failed
|
||||
|
|
Loading…
Reference in a new issue