Remove dependency on kpartx for fake RAID support

With this patch the commands required to support motherboard BIOS
RAID, also known as fake RAID, are dmraid and dmsetup.

If the kpartx command is available, it will be used to maintain
device entries that follow the naming convention used by kpartx.

Closes Ubuntu launchpad bug 554582 - GParted does not list dmraid
devices
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/554582
This commit is contained in:
Curtis Gedak 2010-08-17 10:28:08 -06:00
parent 81986c0990
commit c55a8de305
2 changed files with 19 additions and 13 deletions

4
README
View File

@ -134,8 +134,6 @@ For dmraid support, the following packages are required:
dmsetup - removes /dev/mapper entries
dmraid - lists dmraid devices and creates /dev/mapper entries
kpartx - creates /dev/mapper entries such as
/dev/mapper/isw_idedecefg_Volume0p1
For GNU/Linux distribution dmraid support, the following are required:
- kernel built with Device Mapping and Mirroring built. From menuconfig,
@ -153,6 +151,8 @@ These commands include:
hal-lock - used to prevent automounting of file systems
gksu - used to acquire root privileges in .desktop file,
but only if available when gparted source is configured.
kpartx - used in dmraid to create /dev/mapper entries such as
/dev/mapper/isw_idedecefg_Volume0p1
udevinfo - used in dmraid to query udev name
udevadm - used in dmraid to query udev name

View File

@ -91,7 +91,7 @@ void DMRaid::set_commands_found()
bool DMRaid::is_dmraid_supported()
{
//Determine if dmraid is supported on this computer
return ( dmraid_found && dmsetup_found && kpartx_found ) ;
return ( dmraid_found && dmsetup_found ) ;
}
bool DMRaid::is_dmraid_device( const Glib::ustring & dev_path )
@ -295,7 +295,7 @@ Glib::ustring DMRaid::make_path_dmraid_compatible( Glib::ustring partition_path
bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetail & operationdetail )
{
//Create all missing dev mapper entries for a specified device.
// Try both dmraid -ay and kpartx -a
// Try both dmraid -ay and (if available) kpartx -a
Glib::ustring command ;
bool exit_status = true ;
@ -308,10 +308,13 @@ bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetai
if ( execute_command( command, operationdetail .get_last_child() ) )
exit_status = false ; //command failed
Glib::ustring dmraid_name = get_dmraid_name( partition .device_path ) ;
command = "kpartx -a -v " + DEV_MAP_PATH + dmraid_name ;
if ( execute_command( command, operationdetail .get_last_child() ) )
exit_status = false ; //command failed
if ( kpartx_found )
{
Glib::ustring dmraid_name = get_dmraid_name( partition .device_path ) ;
command = "kpartx -a -v " + DEV_MAP_PATH + dmraid_name ;
if ( execute_command( command, operationdetail .get_last_child() ) )
exit_status = false ; //command failed
}
operationdetail .get_last_child() .set_status( exit_status ? STATUS_SUCCES : STATUS_ERROR ) ;
@ -321,7 +324,7 @@ bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetai
bool DMRaid::create_dev_map_entries( const Glib::ustring & dev_path )
{
//Create all missing dev mapper entries for a specified device.
// Try both dmraid -ay and kpartx -a
// Try both dmraid -ay and (if available) kpartx -a
Glib::ustring command, output, error ;
bool exit_status = true ;
@ -330,10 +333,13 @@ bool DMRaid::create_dev_map_entries( const Glib::ustring & dev_path )
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
if ( kpartx_found )
{
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
}
return exit_status ;
}