[pve-devel] [PATCH] check for valid config changes

Stefan Priebe - Profihost AG s.priebe at profihost.ag
Wed Feb 26 08:35:00 CET 2014


Am 26.02.2014 06:28, schrieb Dietmar Maurer:
>> Am 25.02.2014 16:48, schrieb Dietmar Maurer:
>>>> -	    foreach my $opt (keys %$param) { # add/change
>>>> +	    my $conf_param = { %$param, map {$_ => undef} @delete };
>>>
>>> I guess you need to process @delete parameters first? Or maybe we
>>> should check that we do net set both (param value and delete)?
>>
>> my idea was that delete is more important than param so @delete params
>> overwrite param.
>>
>> Can it happen that we have both?
> 
> AFAIK nothing prevents that (should be easy to test).

OK will send V3.

> Besides, the update code is on the list of things I want ti simplify. IMHO
> the code is already too complex.
> 
> Any idea how we can make that code simpler?

Not without breaking everything. The only idea i had is to have a more
deep hash instead of just params.

Something like:

$params = {

disks = {},

configvalues = {},

cdrom = {},

devices = {
   net => [net0 =, net1 =]
   tablet => ...
},

}

and then have a central hashconfig how to handle each of them.

$parsers = {

disks = \&diskparser,

devices = {
    net = \&netparser,
    tablet = \&tabletparser,
},

}

Stefan




More information about the pve-devel mailing list