From 2a89d936d6f0f5d8d70c87d0191696faf3fa4b12 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Wed, 29 Apr 2009 16:34:30 -0600 Subject: [PATCH] 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. --- include/DMRaid.h | 1 - src/DMRaid.cc | 28 +++------------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/include/DMRaid.h b/include/DMRaid.h index c3a624d6..5bfb0166 100644 --- a/include/DMRaid.h +++ b/include/DMRaid.h @@ -51,7 +51,6 @@ public: int execute_command( const Glib::ustring & command, OperationDetail & operationdetail ) ; void get_devices( std::vector & 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 ) ; diff --git a/src/DMRaid.cc b/src/DMRaid.cc index f74c0f57..5f41c05c 100644 --- a/src/DMRaid.cc +++ b/src/DMRaid.cc @@ -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 & 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