[gparted] Remove dependency on kpartx for fake RAID support
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Remove dependency on kpartx for fake RAID support
- Date: Tue, 17 Aug 2010 16:38:20 +0000 (UTC)
commit c55a8de305f1eab9f31fe87252b9f743282e3a4b
Author: Curtis Gedak <gedakc gmail com>
Date: Tue Aug 17 10:28:08 2010 -0600
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
README | 4 ++--
src/DMRaid.cc | 28 +++++++++++++++++-----------
2 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/README b/README
index 553ccc7..1e8b789 100644
--- a/README
+++ b/README
@@ -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
diff --git a/src/DMRaid.cc b/src/DMRaid.cc
index 8554edf..e954a8d 100644
--- a/src/DMRaid.cc
+++ b/src/DMRaid.cc
@@ -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 ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]