From 446073f6814bf0f81c998b181e6c54fa8188fdc0 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 21 Mar 2012 07:17:11 +0100 Subject: [PATCH] allow to set option 'maxfiles' --- Makefile | 2 +- PVE/API2/Storage/Config.pm | 10 ++++++++++ PVE/Storage.pm | 13 ++++++++++--- changelog.Debian | 6 ++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1a8dbc7..806a072 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ RELEASE=2.0 VERSION=2.0 PACKAGE=libpve-storage-perl -PKGREL=14 +PKGREL=15 DESTDIR= PREFIX=/usr diff --git a/PVE/API2/Storage/Config.pm b/PVE/API2/Storage/Config.pm index 34c2150..4461ddd 100755 --- a/PVE/API2/Storage/Config.pm +++ b/PVE/API2/Storage/Config.pm @@ -168,6 +168,11 @@ __PACKAGE__->register_method ({ type => 'boolean', optional => 1, }, + maxfiles => { + type => 'integer', + optional => 1, + minimum => 0, + }, shared => { type => 'boolean', optional => 1, @@ -270,6 +275,11 @@ __PACKAGE__->register_method ({ type => 'string', format => 'pve-storage-options', optional => 1, }, + maxfiles => { + type => 'integer', + optional => 1, + minimum => 0, + }, digest => { type => 'string', description => 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.', diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 52a6c93..8163d17 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -149,6 +149,7 @@ my $confvars = { target => 'target', nodes => 'nodes', options => 'options', + maxfiles => 'natural', }; my $required_config = { @@ -171,6 +172,7 @@ my $default_config = { nodes => 0, shared => 0, disable => 0, + maxfiles => 0, content => [ { images => 1, rootdir => 1, vztmpl => 1, iso => 1, backup => 1, none => 1 }, { images => 1, rootdir => 1 }], format => [ { raw => 1, qcow2 => 1, vmdk => 1 } , 'raw' ], @@ -183,6 +185,7 @@ my $default_config = { server => 1, export => 1, options => 0, + maxfiles => 0, content => [ { images => 1, rootdir => 1, vztmpl => 1, iso => 1, backup => 1}, { images => 1 }], format => [ { raw => 1, qcow2 => 1, vmdk => 1 } , 'raw' ], @@ -357,6 +360,10 @@ sub check_type { return parse_lvm_name ($value, $noerr); } elsif ($ct eq 'portal') { return verify_portal($value, $noerr); + } elsif ($ct eq 'natural') { + return int($value) if $value =~ m/^\d+$/; + return undef if $noerr; + die "type check ('natural') failed - got '$value'\n"; } elsif ($ct eq 'nodes') { my $res = {}; @@ -711,9 +718,9 @@ sub write_config { foreach my $k (keys %$def) { next if defined ($done_hash->{$k}); - if (defined (my $v = $ids->{$storeid}->{$k})) { - $data .= sprint_config_line ($k, $v); - } + my $v = $ids->{$storeid}->{$k}; + next if !defined($v); + $data .= sprint_config_line ($k, $v); } $out .= "$data\n"; diff --git a/changelog.Debian b/changelog.Debian index 990d37c..b48601c 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -1,3 +1,9 @@ +libpve-storage-perl (2.0-15) unstable; urgency=low + + * allow to set option 'maxfiles' (we will use this for vzdump) + + -- Proxmox Support Team Wed, 21 Mar 2012 07:16:17 +0100 + libpve-storage-perl (2.0-14) unstable; urgency=low * use Digest::SHA instead of Digest::SHA1