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:
parent
81986c0990
commit
c55a8de305
4
README
4
README
|
@ -134,8 +134,6 @@ For dmraid support, the following packages are required:
|
||||||
|
|
||||||
dmsetup - removes /dev/mapper entries
|
dmsetup - removes /dev/mapper entries
|
||||||
dmraid - lists dmraid devices and creates /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:
|
For GNU/Linux distribution dmraid support, the following are required:
|
||||||
- kernel built with Device Mapping and Mirroring built. From menuconfig,
|
- 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
|
hal-lock - used to prevent automounting of file systems
|
||||||
gksu - used to acquire root privileges in .desktop file,
|
gksu - used to acquire root privileges in .desktop file,
|
||||||
but only if available when gparted source is configured.
|
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
|
udevinfo - used in dmraid to query udev name
|
||||||
udevadm - used in dmraid to query udev name
|
udevadm - used in dmraid to query udev name
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ void DMRaid::set_commands_found()
|
||||||
bool DMRaid::is_dmraid_supported()
|
bool DMRaid::is_dmraid_supported()
|
||||||
{
|
{
|
||||||
//Determine if dmraid is supported on this computer
|
//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 )
|
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 )
|
bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetail & operationdetail )
|
||||||
{
|
{
|
||||||
//Create all missing dev mapper entries for a specified device.
|
//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 ;
|
Glib::ustring command ;
|
||||||
bool exit_status = true ;
|
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() ) )
|
if ( execute_command( command, operationdetail .get_last_child() ) )
|
||||||
exit_status = false ; //command failed
|
exit_status = false ; //command failed
|
||||||
|
|
||||||
Glib::ustring dmraid_name = get_dmraid_name( partition .device_path ) ;
|
if ( kpartx_found )
|
||||||
command = "kpartx -a -v " + DEV_MAP_PATH + dmraid_name ;
|
{
|
||||||
if ( execute_command( command, operationdetail .get_last_child() ) )
|
Glib::ustring dmraid_name = get_dmraid_name( partition .device_path ) ;
|
||||||
exit_status = false ; //command failed
|
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 ) ;
|
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 )
|
bool DMRaid::create_dev_map_entries( const Glib::ustring & dev_path )
|
||||||
{
|
{
|
||||||
//Create all missing dev mapper entries for a specified device.
|
//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 ;
|
Glib::ustring command, output, error ;
|
||||||
bool exit_status = true ;
|
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 ) )
|
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 ) ;
|
if ( kpartx_found )
|
||||||
command = "kpartx -a -v " + DEV_MAP_PATH + dmraid_name ;
|
{
|
||||||
if ( Utils::execute_command( command, output, error, true ) )
|
Glib::ustring dmraid_name = get_dmraid_name( dev_path ) ;
|
||||||
exit_status = false; //command failed
|
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 ;
|
return exit_status ;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue