Changeset 2542 in MondoRescue for devel


Ignore:
Timestamp:
Jan 9, 2010, 4:40:59 PM (14 years ago)
Author:
Bruno Cornec
Message:

r3578@localhost: bruno | 2010-01-08 15:12:12 +0100
Begin modifications top replace the *display commands by the *s command in LVM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/mr/lib/MondoRescue/LVM.pm

    r2541 r2542  
    137137
    138138my $OUTPUT = shift;
     139my $lvm;
    139140
    140141my ($lvmver,$lvmcmd) = mr_lvm_check();
    141142return(0) if ($lvmver == 0);
    142143
    143 print $OUTPUT "LVM:$lvmver";
     144print $OUTPUT "LVM:$lvmver\n";
    144145
    145146# Analyze the existing physical volumes
    146 open(LVM,$lvmcmd."pvdisplay -c |") || mr_exit(-1,"Unable to execute ".$lvmcmd."pvdisplay -c");
     147#open(LVM,$lvmcmd."pvdisplay -c |") || mr_exit(-1,"Unable to execute ".$lvmcmd."pvdisplay -c");
     148open(LVM,$lvmcmd."pvs --noheadings --nosuffix --units m --separator : |") || mr_exit(-1,"Unable to execute ".$lvmcmd."pvs");
    147149while (<LVM>) {
     150        s/^[\s]*//;
     151        my ($pv,$vg,$foo,$foo2,$size,$foo3) = split(/:/);
     152        $lvm->{$vg}->{'pv'}[$lvm->{$vg}->{'pvnum'}] = $pv;
     153        $lvm->{$vg}->{'pvnum'}++;
     154        $lvm->{$vg}->{$pv}->{'size'} = $size;
    148155        print $OUTPUT "PV:$_";
    149156}
     
    151158
    152159# Analyze the existing volume groups
    153 open(LVM,$lvmcmd."vgdisplay -c |") || mr_exit(-1,"Unable to execute ".$lvmcmd."vgdisplay -c");
     160#open(LVM,$lvmcmd."vgdisplay -c |") || mr_exit(-1,"Unable to execute ".$lvmcmd."vgdisplay -c");
     161open(LVM,$lvmcmd."vgs --noheadings --nosuffix --units m --separator : |") || mr_exit(-1,"Unable to execute ".$lvmcmd."vgs");
    154162while (<LVM>) {
     163        s/^[\s]*//;
    155164        print $OUTPUT "VG:$_";
    156165}
     
    158167
    159168# Analyze the existing logical volumes
    160 open(LVM,$lvmcmd."lvdisplay -c |") || mr_exit(-1,"Unable to execute ".$lvmcmd."lvdisplay -c");
     169#open(LVM,$lvmcmd."lvdisplay -c |") || mr_exit(-1,"Unable to execute ".$lvmcmd."lvdisplay -c");
     170open(LVM,$lvmcmd."lvs --noheadings --nosuffix --units m --separator : |") || mr_exit(-1,"Unable to execute ".$lvmcmd."lvs");
    161171while (<LVM>) {
     172        s/^[\s]*//;
    162173        print $OUTPUT "LV:$_";
    163174}
    164175close(LVM);
    165 return($lvmver);
     176return($lvm);
    166177}
    167178
Note: See TracChangeset for help on using the changeset viewer.