[pve-devel] [PATCH guest-common 2/2] fix 2682: make sure configuration file is up-to-date for lock_config-variants

Fabian Ebner f.ebner at proxmox.com
Tue Apr 28 14:31:12 CEST 2020


On 28.04.20 13:00, Fabian Ebner wrote:
> This patch breaks container creation for some reason. It'll fail with:
> unable to create CT <ID>: config file already exist
the real error message is:
unable to create CT <ID>: CT <ID> already exists on node '<NODE>'
I pasted the wrong one in a hurry

> I'll investigate why this happens.

The reason is that in create_vm for containers, update_pct_config is 
called before create_and_lock_config and the former leads to a 
write_config call (via vmconfig_apply_pending).

> 
> On 23.04.20 13:51, Fabian Ebner wrote:
>> See [0] for the details. The call tree for the variants is
>> lock_config -> lock_config_full -> lock_config_mode
>> so it is sufficient to adapt lock_config_mode.
>>
>> [0]: https://bugzilla.proxmox.com/show_bug.cgi?id=2682
>>
>> Suggested-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
>> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
>> ---
>>   PVE/AbstractConfig.pm | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm
>> index f1b395c..15368de 100644
>> --- a/PVE/AbstractConfig.pm
>> +++ b/PVE/AbstractConfig.pm
>> @@ -292,7 +292,13 @@ sub lock_config_mode {
>>       my $filename = $class->config_file_lock($vmid);
>> -    my $res = lock_file_full($filename, $timeout, $shared, $code, 
>> @param);
>> +    # make sure configuration file is up-to-date
>> +    my $realcode = sub {
>> +    PVE::Cluster::cfs_update();
>> +    $code->(@param);
>> +    };
>> +
>> +    my $res = lock_file_full($filename, $timeout, $shared, $realcode, 
>> @param);
>>       die $@ if $@;
>>
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list