[pve-devel] r5021 - pve-storage/pve2
svn-commits at proxmox.com
svn-commits at proxmox.com
Mon Aug 16 14:19:16 CEST 2010
Author: dietmar
Date: 2010-08-16 12:19:16 +0000 (Mon, 16 Aug 2010)
New Revision: 5021
Modified:
pve-storage/pve2/Storage.pm
Log:
use new trim() command
Modified: pve-storage/pve2/Storage.pm
===================================================================
--- pve-storage/pve2/Storage.pm 2010-08-16 12:16:31 UTC (rev 5020)
+++ pve-storage/pve2/Storage.pm 2010-08-16 12:19:16 UTC (rev 5021)
@@ -15,7 +15,7 @@
use Getopt::Long qw(GetOptionsFromArray);
use Socket;
use Digest::SHA1;
-use PVE::Tools qw(run_command lock_file safe_print file_read_firstline);
+use PVE::Tools qw(run_command lock_file safe_print file_read_firstline trim);
use PVE::INotify qw(register_file read_file write_file);
my $ISCSIADM = '/usr/bin/iscsiadm';
@@ -400,13 +400,9 @@
} elsif ($ct eq 'content') {
my $valid_content = $def->{content}->[0];
- $value =~ s/[,;]/ /g;
- $value =~ s/\s+/ /g;
-
my $res = {};
- my @ca = split (/\s/, $value);
- foreach my $c (@ca) {
+ foreach my $c (PVE::Tools::split_list($value)) {
return undef if !$valid_content->{$c};
$res->{$c} = 1;
}
@@ -1460,8 +1456,7 @@
run_command ($cmd, outfunc => sub {
my $line = shift;
- $line =~ s/^\s+//;
- $line =~ s/\s+$//;
+ $line = trim($line);
my ($pvname, $size, $vgname, $uuid) = split (':', $line);
@@ -1524,8 +1519,7 @@
run_command ($cmd, outfunc => sub {
my $line = shift;
- $line =~ s/^\s+//;
- $line =~ s/\s+$//;
+ $line = trim($line);
my ($name, $size, $free) = split (':', $line);
@@ -1548,8 +1542,7 @@
run_command ($cmd, outfunc => sub {
my $line = shift;
- $line =~ s/^\s+//;
- $line =~ s/\s+$//;
+ $line = trim($line);
my ($vg, $name, $size, $uuid, $tags) = split (':', $line);
More information about the pve-devel
mailing list