[pve-devel] [PATCH v2 pve-manager] API2 : Network : add network config reload

Dietmar Maurer dietmar at proxmox.com
Mon Sep 24 09:31:55 CEST 2018


> + raise_param_exc({ config => "reloading config with ovs changes is not possible currently\n" }) 
> + if $ovs_changes && !$param->{restart}; 
> + 
> + foreach my $bridge (keys %$bridges_delete) { 
> + 
> + my (undef, $interface) = dir_glob_regex("/sys/class/net/$bridge/brif", '(tap|veth|fwpr).*'); 
> + raise_param_exc({ config => "bridge deletion is not possible currently if vm or ct are running on this bridge\n" }) 
> + if defined($interface); 
> + } 
> + 
> + PVE::Tools::file_copy($new_config_file, $current_config_file); 
> + unlink $new_config_file; 
> + 
> + my $worker = sub { 
> + PVE::Tools::run_command(['systemctl', 'reload', 'networking']); 
> + }; 
> + return $rpcenv->fork_worker('srvreload', 'networking', $authuser, $worker); 
> + }}); 

This looks fragile. Maybe we should first 'reload', and only rewrite if reload is successful? Even better, a 'reload' should return the applied configuration, and we only commit that?



More information about the pve-devel mailing list