[pve-devel] [PATCH v2 pve-manager] API2 : Network : add network config reload
Alexandre DERUMIER
aderumier at odiso.com
Mon Sep 24 11:18:10 CEST 2018
>>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" <dietmar at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>, "aderumier" <aderumier at 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?
More information about the pve-devel
mailing list