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:
Curtis Gedak 2009-04-29 16:34:30 -06:00
parent 3f773c3ae8
commit 2a89d936d6
2 changed files with 3 additions and 26 deletions

View File

@ -51,7 +51,6 @@ public:
int execute_command( const Glib::ustring & command, OperationDetail & operationdetail ) ; int execute_command( const Glib::ustring & command, OperationDetail & operationdetail ) ;
void get_devices( std::vector<Glib::ustring> & dmraid_devices ) ; void get_devices( std::vector<Glib::ustring> & dmraid_devices ) ;
Glib::ustring get_dmraid_name( const Glib::ustring & dev_path ) ; 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 ) ; int get_partition_number( const Glib::ustring & partition_name ) ;
Glib::ustring get_udev_name( const Glib::ustring & dev_path ) ; Glib::ustring get_udev_name( const Glib::ustring & dev_path ) ;
bool create_dev_map_entries( const Partition & partition, OperationDetail & operationdetail ) ; bool create_dev_map_entries( const Partition & partition, OperationDetail & operationdetail ) ;

View File

@ -176,25 +176,6 @@ Glib::ustring DMRaid::get_dmraid_name( const Glib::ustring & dev_path )
return dmraid_name ; 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 ) 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 //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 ) ; Glib::ustring tmp = String::ucompose ( _("create missing %1 entries"), DEV_MAP_PATH ) ;
operationdetail .add_child( OperationDetail( tmp ) ); operationdetail .add_child( OperationDetail( tmp ) );
Glib::ustring dmraid_prefix = get_dmraid_prefix( partition .device_path ) ; command = "dmraid -ay -v" ;
command = "dmraid -ay -v " + dmraid_prefix ;
if ( execute_command( command, operationdetail .get_last_child() ) ) if ( execute_command( command, operationdetail .get_last_child() ) )
exit_status = false ; //command failed 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 ; Glib::ustring command, output, error ;
bool exit_status = true ; bool exit_status = true ;
Glib::ustring dmraid_prefix = get_dmraid_prefix( dev_path ) ; command = "dmraid -ay -v" ;
Glib::ustring dmraid_name = get_dmraid_name( dev_path ) ;
command = "dmraid -ay -v " + dmraid_prefix ;
if ( Utils::execute_command( command, output, error, true ) ) if ( Utils::execute_command( command, output, error, true ) )
exit_status = false; //command failed exit_status = false; //command failed
Glib::ustring dmraid_name = get_dmraid_name( dev_path ) ;
command = "kpartx -a -v " + DEV_MAP_PATH + dmraid_name ; command = "kpartx -a -v " + DEV_MAP_PATH + dmraid_name ;
if ( Utils::execute_command( command, output, error, true ) ) if ( Utils::execute_command( command, output, error, true ) )
exit_status = false; //command failed exit_status = false; //command failed