Changeset 2149 in MondoRescue for devel/mindi/sbin/mranalyze-lvm


Ignore:
Timestamp:
Feb 16, 2009, 5:50:07 PM (15 years ago)
Author:
Bruno Cornec
Message:

Begining f devl branch coding nd preliminary organisation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/mindi/sbin/mranalyze-lvm

    r2119 r2149  
    1515use Data::Dumper;
    1616use English;
    17 use File::Basename;
    18 use File::Copy;
    19 use File::stat;
    20 use File::Temp qw(tempdir);
    21 use POSIX qw(strftime);
    2217use lib qw (lib);
    2318use ProjectBuilder::Base;
    2419use ProjectBuilder::Distribution;
     20use MondoRescue::Base;
     21use MondoRescue::Mindi::LVM;
    2522
    2623=pod
     
    137134
    138135# -------------------------------- main -----------------------------------
    139 my ($lvmver,$lvmcmd) = mr_lvm_check();
    140 
    141136# Where to send the output
    142137my $OUTPUT = \*STDOUT;
     
    146141}
    147142
    148 print $OUTPUT "LVM:$lvmver";
     143my $ret = mr_lvm_analyze($OUTPUT);
    149144
    150 # Analyze the existing physical volumes
    151 open(LVM,"$lvmcmd pvdisplay -c |") || mr_exit(-1,"Unable to execute $lvmcmd pvdisplay -c");
    152 while (<LVM>) {
    153         print $OUTPUT "PV:$_";
     145if ($ret == 0) {
     146    pb_log(1,"No LVM handling")
     147} else {
     148    pb_log(1,"LVM v$lvmver Structure Analyzed")
    154149}
    155 close(LVM);
    156 
    157 # Analyze the existing volume groups
    158 open(LVM,"$lvmcmd vgdisplay -c |") || mr_exit(-1,"Unable to execute $lvmcmd vgdisplay -c");
    159 while (<LVM>) {
    160         print $OUTPUT "VG:$_";
    161 }
    162 close(LVM);
    163 
    164 # Analyze the existing logical volumes
    165 open(LVM,"$lvmcmd lvdisplay -c |") || mr_exit(-1,"Unable to execute $lvmcmd lvdisplay -c");
    166 while (<LVM>) {
    167         print $OUTPUT "LV:$_";
    168 }
    169 close(LVM);
    170 
     150close($OUTPUT);
    171151mr_exit(0,undef);
    172 
    173 sub mr_exit {
    174 
    175 my $code = shift;
    176 my $msg = shift;
    177 
    178 close(OUTPUT);
    179 print $msg."\n" if ((defined $msg) and ($pbdebug >= 0));
    180 die "ERROR returned\n" if ($code < 0);
    181 print "No LVM handling\n" if (($code > 0) and ($pbdebug >= 0));
    182 exit($code);
    183 }
Note: See TracChangeset for help on using the changeset viewer.