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 { ...@@ -516,22 +516,25 @@ sub get_lvm_mapping {
my $devmapper; my $devmapper;
my $cmd = "lvs --units m --separator ':' --noheadings -o vg_name,lv_name,lv_size"; my $cmd = ['lvs', '--units', 'm', '--separator', ':', '--noheadings',
if (my $fd = IO::File->new ("$cmd 2>/dev/null|")) { '-o', 'vg_name,lv_name,lv_size' ];
while (my $line = <$fd>) {
if ($line =~ m|^\s*(\S+):(\S+):(\d+(\.\d+))[Mm]$|) { my $parser = sub {
my $vg = $1; my $line = shift;
my $lv = $2; if ($line =~ m|^\s*(\S+):(\S+):(\d+(\.\d+))[Mm]$|) {
$devmapper->{"/dev/$vg/$lv"} = [$vg, $lv]; my $vg = $1;
my $qlv = $lv; my $lv = $2;
$qlv =~ s/-/--/g; $devmapper->{"/dev/$vg/$lv"} = [$vg, $lv];
my $qvg = $vg; my $qlv = $lv;
$qvg =~ s/-/--/g; $qlv =~ s/-/--/g;
$devmapper->{"/dev/mapper/$qvg-$qlv"} = [$vg, $lv]; my $qvg = $vg;
} $qvg =~ s/-/--/g;
} $devmapper->{"/dev/mapper/$qvg-$qlv"} = [$vg, $lv];
close ($fd); }
} };
eval { PVE::Tools::run_command($cmd, errfunc => sub {}, outfunc => $parser); };
warn $@ if $@;
return $devmapper; return $devmapper;
} }
...@@ -539,24 +542,26 @@ sub get_lvm_mapping { ...@@ -539,24 +542,26 @@ sub get_lvm_mapping {
sub get_mount_info { sub get_mount_info {
my ($dir) = @_; my ($dir) = @_;
my $out; my $cmd = [ 'df', '-P', '-T', '-B', '1', $dir];
if (my $fd = IO::File->new ("df -P -T '$dir' 2>/dev/null|")) {
<$fd>; #skip first line
$out = <$fd>;
close ($fd);
}
return undef if !$out; my $res;
my @res = $out =~ m/^(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)%\s+(.*)$/;
return undef if scalar (@res) != 7; my $parser = sub {
my $line = shift;
return { if (my ($fsid, $fstype, $mp) = $line =~
device => $res[0], m|^(\S+.*)\s+(\S+)\s+\d+\s+\d+\s+\d+\s+\d+%\s+(/.*)$|) {
fstype => $res[1], $res = {
mountpoint => $res[6] device => $fsid,
fstype => $fstype,
mountpoint => $mp,
};
}
}; };
eval { PVE::Tools::run_command($cmd, errfunc => sub {}, outfunc => $parser); };
warn $@ if $@;
return $res;
} }
sub get_lvm_device { 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 pve-manager (2.0-37) unstable; urgency=low
* updated fr translation * updated fr translation
......
...@@ -2,7 +2,7 @@ RELEASE=2.0 ...@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0 VERSION=2.0
PACKAGE=pve-manager PACKAGE=pve-manager
PACKAGERELEASE=37 PACKAGERELEASE=38
BINDIR=${DESTDIR}/usr/bin BINDIR=${DESTDIR}/usr/bin
PERLLIBDIR=${DESTDIR}/usr/share/perl5 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