pf-tools commit: r546 [ccaillet-guest] - /trunk/lib/PFTools/Disk.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Fri Sep 28 09:38:08 UTC 2007


Author: ccaillet-guest
Date: Fri Sep 28 09:38:08 2007
New Revision: 546

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=546
Log:
FIX:
  * fix typo in error msg on MakeRaidArray

FEATURE:
  * adding ManageFilesystem for creating or checking a filesystem


Modified:
    trunk/lib/PFTools/Disk.pm

Modified: trunk/lib/PFTools/Disk.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Disk.pm?rev=546&op=diff
==============================================================================
--- trunk/lib/PFTools/Disk.pm (original)
+++ trunk/lib/PFTools/Disk.pm Fri Sep 28 09:38:08 2007
@@ -39,7 +39,8 @@
 ### Command vars
 my $MDADM	= '/sbin/mdadm' ;
 my $DRBDADM	= '/sbin/drbdadm' ;
-my $MKFS	= 'mkfs.' ;
+my $MKFS	= '/sbin/mkfs.' ;
+my $FSCK	= '/sbin/fsck.' ;
 my $SFDISK	= '/sbin/sfdisk' ;
 my $FDISK	= '/sbin/fdisk' ;
 my $HALT	= '/sbin/halt' ;
@@ -587,7 +588,7 @@
 	if ( $DEBUG ) {
 		print 'Exec : '.$cmd."\n" ;
 	} else {
-		if ( ! Exec_cmd ( $cmd, "Unable to create RAID array level ".$raid_level" with command ".$cmd." and with the following error(s)\n" ) ) {
+		if ( ! Exec_cmd ( $cmd, "Unable to create RAID array level ".$raid_level." with command ".$cmd." and with the following error(s)\n" ) ) {
 			return 0 ;
 		}
 	}
@@ -631,3 +632,30 @@
 #
 # Managing DRBD cluster(s)
 #
+
+#
+# Managing filesystems ( formatting, checking ...)
+#
+
+sub ManageFilesystem ($$) {
+	# Variables en parametres d'appel
+	my ( $device, $fs_type, $action ) = @_ ;
+	# Variables locales a la fonction
+	my $cmd ;
+
+	if ( $action eq 'make' ) {
+		$cmd = $MKFS.$fs_type.' '.$device ;
+	} elsif ( $action eq 'check' ) {
+		$cmd = $FSCK.$fs_type.' -y '.$device ;
+	} else {
+		warn "ManageFilesystem -- Unknown action ".$action." : allowed actions are make and check\n" ;
+		return 0 ;
+	}
+	if ( $DEBUG ) {
+		print 'Exec : '.$cmd."\n" ;
+	} else {
+		return Exec_cmd ( $cmd, "Unable to manage filesystem with command ".$cmd." and with the following error(s)\n" ) ;
+	}
+}
+
+1;




More information about the Pf-tools-commits mailing list