Changeset 2541 for devel


Ignore:
Timestamp:
Jan 9, 2010, 4:40:56 PM (9 years ago)
Author:
bruno
Message:

r3577@localhost: bruno | 2010-01-08 02:23:52 +0100
The 2 first commands check and analyze begin to work

Location:
devel/mr
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • devel/mr/etc/mondorescue.conf

    r2540 r2541  
    2424# Is it LSB ?
    2525#
    26 mr_lvmdiskscan default = /usr/sbin/lvmdiskscan
     26mr_lvmdiskscan default = /sbin/lvmdiskscan
    2727mr_lvmprocfile default = /proc/lvm/global
    28 mr_lvmcmd default = /usr/sbin/lvm   
    29 mr_lvmpath default = /usr/sbin/
     28mr_lvmcmd default = /sbin/lvm
     29mr_lvmpath default = /sbin/
  • devel/mr/lib/MondoRescue/Base.pm

    r2540 r2541  
    6363my ($confdir,$localdir,$pbproj) = mr_dynconf_init();
    6464
     65# Temp dir
     66pb_temp_init();
     67
    6568# First use the main configuration file
    6669pb_conf_init($pbproj);
  • devel/mr/lib/MondoRescue/LVM.pm

    r2540 r2541  
    1616use ProjectBuilder::Base;
    1717use ProjectBuilder::Conf;
     18use MondoRescue::Base;
    1819
    1920# Inherit from the "Exporter" module which handles exporting functions.
     
    5859my $lvmpath = $lvmpath_t->{$ENV{PBPROJ}};
    5960
     61# That file is not mandatory anymore
    6062if (! -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}
    7476
    7577# Check LVM version
    76 my $lvmver=0;
    77 if (-x $lvmds ) {
     78my $lvmver = 0;
     79if (-x $lvmds) {
     80    pb_log(2,"Checking with $lvmds\n");
    7881    open(LVM,"$lvmds --help 2>&1 |") || mr_exit(-1,"Unable to execute $lvmds");
    7982    while (<LVM>) {
    8083        if (/Logical Volume Manager/ || /LVM version:/) {
    8184                $lvmver = $_;
     85                chomp($lvmver);
    8286                $lvmver =~ s/:([0-9])\..*/$1/;
    8387        }
    8488    }
    85 }
    86 close(LVM);
     89    close(LVM);
     90    pb_log(2,"Found a LVM version of $lvmver with $lvmds --help\n");
     91}
    8792
    8893if ($lvmver == 0) {
    89     # Still not found
     94    pb_log(2,"LVM version value is still not known\n");
    9095    if (-x $lvmcmd) {
     96        pb_log(2,"Checking with $lvmcmd\n");
    9197        open(LVM,"$lvmcmd version |") || mr_exit(-1,"Unable to execute $lvmcmd");
    9298        while (<LVM>) {
    9399            if (/LVM version/) {
    94100                $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/;
    96104            }
    97105        }
    98106        close(LVM);
     107        pb_log(2,"Found a LVM version of $lvmver with $lvmcmd version\n");
    99108    }
    100109}
     
    102111if ($lvmver == 0) {
    103112    # 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");
    105114} elsif ($lvmver == 1) {
    106115    $lvmcmd = "$lvmpath";
     
    108117    $lvmcmd .= " ";
    109118} else {
    110     pb_log(0,"Unknown LVM version $lvmver");
     119    pb_log(0,"Unknown LVM version $lvmver\n");
    111120}
    112121# Here $lvmcmd contains a full path name
    113 pb_log(1,"Found LVM version $lvmver");
     122pb_log(1,"Found LVM version $lvmver\n");
    114123return ($lvmver,$lvmcmd);
    115124
     
    203212        print $OUTPUT "\n";
    204213    } elsif (/^LV:/) {
    205         if ($firsttime eq 0) {
     214        if ($firsttime == 0) {
    206215            print $OUTPUT "\n";
    207216            print $OUTPUT "# Activate All Volume Groups\n";
  • devel/mr/sbin/mranalyze-lvm

    r2540 r2541  
    128128my $MINDI_LIB = "PBLIB";
    129129my $MINDI_SBIN = "$MINDI_PREFIX/sbin";
    130 #
    131 # Temp dir
    132 #
    133 pb_temp_init();
    134130
    135 # MondoRescue init
     131# Init
    136132mr_init();
    137133
     
    151147    pb_log(1,"LVM v$lvmver Structure Analyzed")
    152148}
    153 close($OUTPUT);
     149if (defined $opts{'o'}) {
     150    close($OUTPUT);
     151}
    154152mr_exit(0,undef);
  • devel/mr/sbin/mrcheck-lvm

    r2540 r2541  
    2525=head1 NAME
    2626
    27 mranalyze-lvm - A Mindi Tool to analyze the LVM configuration and store it
     27mrcheck-lvm - A Mindi Tool to check the LVM basic info
    2828
    2929=head1 DESCRIPTION
    3030
    31 B<mranalyze-lvm> prints all the information related to the LVM configuration that may be used by a restoration process
     31B<mrcheck-lvm> prints all the information related to the LVM configuration that may be used by a restoration process
    3232
    3333=head1 SYNOPSIS
    3434
    35 mranalyze-lvm [-v]|[-q]|[-h]|[--man][-o outputfile][-l logfile]
     35mrcheck-lvm [-v]|[-q]|[-h]|[--man][-o outputfile][-l logfile]
    3636
    3737=head1 OPTIONS
     
    9393# Initialize the syntax string
    9494
    95 pb_syntax_init("mranalyze-lvm Version PBVER-rPBREV\n");
     95pb_syntax_init("mrcheck-lvm Version PBVER-rPBREV\n");
    9696
    9797# Handle options
     
    128128my $MINDI_LIB = "PBLIB";
    129129my $MINDI_SBIN = "$MINDI_PREFIX/sbin";
    130 #
    131 # Temp dir
    132 #
    133 pb_temp_init();
     130
     131# Init
     132mr_init();
    134133
    135134# -------------------------------- main -----------------------------------
     
    141140}
    142141
    143 my $lvmver = mr_lvm_analyze($OUTPUT);
     142my ($lvmver,$lvmcmd) = mr_lvm_check($OUTPUT);
     143if (defined $opts{'o'}) {
     144    close($OUTPUT);
     145}
    144146
    145147if ($lvmver == 0) {
    146     pb_log(1,"No LVM handling")
     148    pb_log(0,"No LVM handling\n")
    147149} else {
    148     pb_log(1,"LVM v$lvmver Structure Analyzed")
     150    pb_log(0,"LVM v$lvmver command is $lvmcmd\n")
    149151}
    150 close($OUTPUT);
    151152mr_exit(0,undef);
Note: See TracChangeset for help on using the changeset viewer.