[pve-devel] [PATCH manager 1/1] vzdump: prepare 'exclude-path' for array format

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Jun 5 09:59:42 CEST 2023


On Mon, Jun 05, 2023 at 09:54:49AM +0200, Dominik Csapak wrote:
> On 6/5/23 09:36, Wolfgang Bumiller wrote:
> > On Fri, May 12, 2023 at 02:23:51PM +0200, Dominik Csapak wrote:
> > > we want to move the 'exclude-path' to an array format (from 'string-alist')
> > > prepare the code that it can be either a string or a list
> > > 
> > > Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> > > ---
> > >   PVE/VZDump.pm | 21 +++++++++++++++++----
> > >   1 file changed, 17 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
> > > index a04837e7e..dde347562 100644
> > > --- a/PVE/VZDump.pm
> > > +++ b/PVE/VZDump.pm
> > > @@ -279,7 +279,15 @@ sub read_vzdump_defaults {
> > >       my $conf_schema = { type => 'object', properties => $confdesc_for_defaults };
> > >       my $res = PVE::JSONSchema::parse_config($conf_schema, $fn, $raw);
> > >       if (my $excludes = $res->{'exclude-path'}) {
> > > -	$res->{'exclude-path'} = PVE::Tools::split_args($excludes);
> > > +	if (ref($excludes) eq 'ARRAY') {
> > > +	    my $list = [];
> > > +	    for my $path ($excludes->@*) {
> > > +		push $list->@*, PVE::Tools::split_args($path)->@*;
> > 
> > With this being an array, I don't think it makes sense to call
> > `split_args()` on the individual items?
> 
> actually we have to do this to keep compatibility with current configs:
> 
> currently users can put things like this in the config:
> 
> exclude-path: /foo /bar
> 
> and both paths will be excluded
> 
> if we omit the splitting we'd have to rewrite the configs to:
> 
> exclude-path: /foo
> exclude-path: /bar
> 
> while we could do that, i opted here for the simpler approach to handle
> the lines the same, without need to break existing configs
> and/or rewriting configs on upgrade

Right, that is unfortunate.
Maybe we can at some point figure out a syntax hint to change this
behavior, as I find this a bit unintuitive when actually using multiple
entries.





More information about the pve-devel mailing list