Commit af81df02 authored by Dietmar Maurer's avatar Dietmar Maurer

fix bug 101: use run_command to avoid locale errors

parent bb95ab1d
...@@ -516,9 +516,11 @@ sub get_lvm_mapping { ...@@ -516,9 +516,11 @@ 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>) {
my $parser = sub {
my $line = shift;
if ($line =~ m|^\s*(\S+):(\S+):(\d+(\.\d+))[Mm]$|) { if ($line =~ m|^\s*(\S+):(\S+):(\d+(\.\d+))[Mm]$|) {
my $vg = $1; my $vg = $1;
my $lv = $2; my $lv = $2;
...@@ -529,9 +531,10 @@ sub get_lvm_mapping { ...@@ -529,9 +531,10 @@ sub get_lvm_mapping {
$qvg =~ s/-/--/g; $qvg =~ s/-/--/g;
$devmapper->{"/dev/mapper/$qvg-$qlv"} = [$vg, $lv]; $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+(.*)$/; 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,
};
}
};
return undef if scalar (@res) != 7; eval { PVE::Tools::run_command($cmd, errfunc => sub {}, outfunc => $parser); };
warn $@ if $@;
return { return $res;
device => $res[0],
fstype => $res[1],
mountpoint => $res[6]
};
} }
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