Changeset 2541 in MondoRescue
- Timestamp:
- Jan 9, 2010, 4:40:56 PM (15 years ago)
- Location:
- devel/mr
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/mr/etc/mondorescue.conf
r2540 r2541 24 24 # Is it LSB ? 25 25 # 26 mr_lvmdiskscan default = / usr/sbin/lvmdiskscan26 mr_lvmdiskscan default = /sbin/lvmdiskscan 27 27 mr_lvmprocfile default = /proc/lvm/global 28 mr_lvmcmd default = / usr/sbin/lvm29 mr_lvmpath default = / usr/sbin/28 mr_lvmcmd default = /sbin/lvm 29 mr_lvmpath default = /sbin/ -
devel/mr/lib/MondoRescue/Base.pm
r2540 r2541 63 63 my ($confdir,$localdir,$pbproj) = mr_dynconf_init(); 64 64 65 # Temp dir 66 pb_temp_init(); 67 65 68 # First use the main configuration file 66 69 pb_conf_init($pbproj); -
devel/mr/lib/MondoRescue/LVM.pm
r2540 r2541 16 16 use ProjectBuilder::Base; 17 17 use ProjectBuilder::Conf; 18 use MondoRescue::Base; 18 19 19 20 # Inherit from the "Exporter" module which handles exporting functions. … … 58 59 my $lvmpath = $lvmpath_t->{$ENV{PBPROJ}}; 59 60 61 # That file is not mandatory anymore 60 62 if (! -x $lvmproc) { 61 pb_log(1,"$lvmproc doesn't exist .");62 return(0,undef); 63 }64 65 # Check LVM volumes presence 66 open(LVM,$lvmproc) || mr_exit(-1,"Unable to open $lvmproc"); 67 while (<LVM>) {68 if (/0 VGs 0 PVs 0 LVs/) {69 pb_log(1,"No LVM volumes found in $lvmproc");70 return(0,undef);71 } 72 } 73 close(LVM); 63 pb_log(1,"$lvmproc doesn't exist\n"); 64 } else { 65 # Check LVM volumes presence 66 pb_log(2,"Checking with $lvmproc\n"); 67 open(LVM,$lvmproc) || mr_exit(-1,"Unable to open $lvmproc"); 68 while (<LVM>) { 69 if (/0 VGs 0 PVs 0 LVs/) { 70 pb_log(1,"No LVM volumes found in $lvmproc\n"); 71 return(0,undef); 72 } 73 } 74 close(LVM); 75 } 74 76 75 77 # Check LVM version 76 my $lvmver=0; 77 if (-x $lvmds ) { 78 my $lvmver = 0; 79 if (-x $lvmds) { 80 pb_log(2,"Checking with $lvmds\n"); 78 81 open(LVM,"$lvmds --help 2>&1 |") || mr_exit(-1,"Unable to execute $lvmds"); 79 82 while (<LVM>) { 80 83 if (/Logical Volume Manager/ || /LVM version:/) { 81 84 $lvmver = $_; 85 chomp($lvmver); 82 86 $lvmver =~ s/:([0-9])\..*/$1/; 83 87 } 84 88 } 85 } 86 close(LVM); 89 close(LVM); 90 pb_log(2,"Found a LVM version of $lvmver with $lvmds --help\n"); 91 } 87 92 88 93 if ($lvmver == 0) { 89 # Still not found94 pb_log(2,"LVM version value is still not known\n"); 90 95 if (-x $lvmcmd) { 96 pb_log(2,"Checking with $lvmcmd\n"); 91 97 open(LVM,"$lvmcmd version |") || mr_exit(-1,"Unable to execute $lvmcmd"); 92 98 while (<LVM>) { 93 99 if (/LVM version/) { 94 100 $lvmver = $_; 95 $lvmver =~ s/LVM version ([0-9])\..*/$1/; 101 chomp($lvmver); 102 $lvmver =~ s/:([0-9])\..*/$1/; 103 $lvmver =~ s/[\s]*LVM version[:]*[\s]+([0-9])\..*/$1/; 96 104 } 97 105 } 98 106 close(LVM); 107 pb_log(2,"Found a LVM version of $lvmver with $lvmcmd version\n"); 99 108 } 100 109 } … … 102 111 if ($lvmver == 0) { 103 112 # Still not found 104 mr_exit(-1,"Unable to determine LVM version.\nPlease report to the dev team with the result of the commands \n$lvmds and $lvmcmd");113 mr_exit(-1,"Unable to determine LVM version.\nPlease report to the dev team with the result of the commands:\n$lvmds --help and $lvmcmd version\n"); 105 114 } elsif ($lvmver == 1) { 106 115 $lvmcmd = "$lvmpath"; … … 108 117 $lvmcmd .= " "; 109 118 } else { 110 pb_log(0,"Unknown LVM version $lvmver ");119 pb_log(0,"Unknown LVM version $lvmver\n"); 111 120 } 112 121 # Here $lvmcmd contains a full path name 113 pb_log(1,"Found LVM version $lvmver ");122 pb_log(1,"Found LVM version $lvmver\n"); 114 123 return ($lvmver,$lvmcmd); 115 124 … … 203 212 print $OUTPUT "\n"; 204 213 } elsif (/^LV:/) { 205 if ($firsttime eq0) {214 if ($firsttime == 0) { 206 215 print $OUTPUT "\n"; 207 216 print $OUTPUT "# Activate All Volume Groups\n"; -
devel/mr/sbin/mranalyze-lvm
r2540 r2541 128 128 my $MINDI_LIB = "PBLIB"; 129 129 my $MINDI_SBIN = "$MINDI_PREFIX/sbin"; 130 #131 # Temp dir132 #133 pb_temp_init();134 130 135 # MondoRescue init131 # Init 136 132 mr_init(); 137 133 … … 151 147 pb_log(1,"LVM v$lvmver Structure Analyzed") 152 148 } 153 close($OUTPUT); 149 if (defined $opts{'o'}) { 150 close($OUTPUT); 151 } 154 152 mr_exit(0,undef); -
devel/mr/sbin/mrcheck-lvm
r2540 r2541 25 25 =head1 NAME 26 26 27 mr analyze-lvm - A Mindi Tool to analyze the LVM configuration and store it27 mrcheck-lvm - A Mindi Tool to check the LVM basic info 28 28 29 29 =head1 DESCRIPTION 30 30 31 B<mr analyze-lvm> prints all the information related to the LVM configuration that may be used by a restoration process31 B<mrcheck-lvm> prints all the information related to the LVM configuration that may be used by a restoration process 32 32 33 33 =head1 SYNOPSIS 34 34 35 mr analyze-lvm [-v]|[-q]|[-h]|[--man][-o outputfile][-l logfile]35 mrcheck-lvm [-v]|[-q]|[-h]|[--man][-o outputfile][-l logfile] 36 36 37 37 =head1 OPTIONS … … 93 93 # Initialize the syntax string 94 94 95 pb_syntax_init("mr analyze-lvm Version PBVER-rPBREV\n");95 pb_syntax_init("mrcheck-lvm Version PBVER-rPBREV\n"); 96 96 97 97 # Handle options … … 128 128 my $MINDI_LIB = "PBLIB"; 129 129 my $MINDI_SBIN = "$MINDI_PREFIX/sbin"; 130 # 131 # Temp dir 132 # 133 pb_temp_init(); 130 131 # Init 132 mr_init(); 134 133 135 134 # -------------------------------- main ----------------------------------- … … 141 140 } 142 141 143 my $lvmver = mr_lvm_analyze($OUTPUT); 142 my ($lvmver,$lvmcmd) = mr_lvm_check($OUTPUT); 143 if (defined $opts{'o'}) { 144 close($OUTPUT); 145 } 144 146 145 147 if ($lvmver == 0) { 146 pb_log( 1,"No LVM handling")148 pb_log(0,"No LVM handling\n") 147 149 } else { 148 pb_log( 1,"LVM v$lvmver Structure Analyzed")150 pb_log(0,"LVM v$lvmver command is $lvmcmd\n") 149 151 } 150 close($OUTPUT);151 152 mr_exit(0,undef);
Note:
See TracChangeset
for help on using the changeset viewer.