>>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? 

It's possible to test the syntax of configuration with

"ifreload -a -s"



ifupdown2 reload should work for almost 99% of cases, only interface options 
not able to be change online in kernel can give error. (mostly some vxlan 
options from what I've seen).
maybe for theses known exceptions (we can catch them with ifreload -a, "error: 
interface: ...."), then force ifdown/ifup interfaces theses interfaces?

I'm not sure if it's possible to try to reload directly 
/etc/network/interfaces.new, then if it's ok, overwrite 
/etc/network/interfaces. I'll look at this.





----- Mail original -----
De: "dietmar" <diet...@proxmox.com>
À: "pve-devel" <pve-devel@pve.proxmox.com>, "aderumier" <aderum...@odiso.com>
Envoyé: Lundi 24 Septembre 2018 09:31:55
Objet: Re: [pve-devel] [PATCH v2 pve-manager] API2 : Network : add network 
config reload

> + 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? 

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to