Commit af81df02 authored by Dietmar Maurer's avatar Dietmar Maurer

fix bug 101: use run_command to avoid locale errors

parent bb95ab1d
......@@ -516,22 +516,25 @@ sub get_lvm_mapping {
my $devmapper;
my $cmd = "lvs --units m --separator ':' --noheadings -o vg_name,lv_name,lv_size";
if (my $fd = IO::File->new ("$cmd 2>/dev/null|")) {
while (my $line = <$fd>) {
if ($line =~ m|^\s*(\S+):(\S+):(\d+(\.\d+))[Mm]$|) {
my $vg = $1;
my $lv = $2;
$devmapper->{"/dev/$vg/$lv"} = [$vg, $lv];
my $qlv = $lv;
$qlv =~ s/-/--/g;
my $qvg = $vg;
$qvg =~ s/-/--/g;
$devmapper->{"/dev/mapper/$qvg-$qlv"} = [$vg, $lv];
}
}
close ($fd);
}
my $cmd = ['lvs', '--units', 'm', '--separator', ':', '--noheadings',
'-o', 'vg_name,lv_name,lv_size' ];
my $parser = sub {
my $line = shift;
if ($line =~ m|^\s*(\S+):(\S+):(\d+(\.\d+))[Mm]$|) {
my $vg = $1;
my $lv = $2;
$devmapper->{"/dev/$vg/$lv"} = [$vg, $lv];
my $qlv = $lv;
$qlv =~ s/-/--/g;
my $qvg = $vg;
$qvg =~ s/-/--/g;
$devmapper->{"/dev/mapper/$qvg-$qlv"} = [$vg, $lv];
}
};
eval { PVE::Tools::run_command($cmd, errfunc => sub {}, outfunc => $parser); };
warn $@ if $@;
return $devmapper;
}
......@@ -539,24 +542,26 @@ sub get_lvm_mapping {
sub get_mount_info {
my ($dir) = @_;
my $out;
if (my $fd = IO::File->new ("df -P -T '$dir' 2>/dev/null|")) {
<$fd>; #skip first line
$out = <$fd>;
close ($fd);
}
my $cmd = [ 'df', '-P', '-T', '-B', '1', $dir];
return undef if !$out;
my @res = $out =~ m/^(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)%\s+(.*)$/;
my $res;
return undef if scalar (@res) != 7;
return {
device => $res[0],
fstype => $res[1],
mountpoint => $res[6]
my $parser = sub {
my $line = shift;
if (my ($fsid, $fstype, $mp) = $line =~
m|^(\S+.*)\s+(\S+)\s+\d+\s+\d+\s+\d+\s+\d+%\s+(/.*)$|) {
$res = {
device => $fsid,
fstype => $fstype,
mountpoint => $mp,
};
}
};
eval { PVE::Tools::run_command($cmd, errfunc => sub {}, outfunc => $parser); };
warn $@ if $@;
return $res;
}
sub get_lvm_device {
......
pve-manager (2.0-38) unstable; urgency=low
* fix bug 101: vzdump use run_command to avoid locale errors
-- Proxmox Support Team <support@proxmox.com> Thu, 01 Mar 2012 10:45:40 +0100
pve-manager (2.0-37) unstable; urgency=low
* updated fr translation
......
......@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0
PACKAGE=pve-manager
PACKAGERELEASE=37
PACKAGERELEASE=38
BINDIR=${DESTDIR}/usr/bin
PERLLIBDIR=${DESTDIR}/usr/share/perl5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment