[pve-devel] applied: [PATCH manager] api: network reload: more granular OVS change check
Alexandre DERUMIER
aderumier at odiso.com
Tue Nov 26 12:01:39 CET 2019
Damn, you are too fast, I'll rebase my pve-manager patch for sdn ;)
----- Mail original -----
De: "Thomas Lamprecht" <t.lamprecht at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Mardi 26 Novembre 2019 11:45:04
Objet: [pve-devel] applied: [PATCH manager] api: network reload: more granular OVS change check
Just because OVS is installed it doesn't mean that OVS interface
(changes) are configured - so check for that.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
PVE/API2/Network.pm | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index fa605ba7..60178c86 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -554,7 +554,25 @@ __PACKAGE__->register_method({
my $new_config_file = "/etc/network/interfaces.new";
die "you need ifupdown2 to reload networking\n" if !-e '/usr/share/ifupdown2';
- die "ifupdown2 reload is not compatible if openvswitch currently" if -x '/usr/bin/ovs-vsctl';
+
+ if (-x '/usr/bin/ovs-vsctl') {
+ my $ovs_configured = sub {
+ my $ifaces = shift;
+ my @ovstypes = grep { $_->{type} =~ /^ovs\S+/i } values %$ifaces;
+ return scalar(@ovstypes) > 0;
+ };
+ my $tmp = PVE::INotify::read_file('interfaces', 1);
+ my $ifaces = $tmp->{data}->{ifaces};
+ my $changes = $tmp->{changes};
+
+ if ($ovs_configured->($ifaces)) {
+ die "There are OpenVSwitch configured interfaces, but ifupdown2 ".
+ " reload is not compatible with openvswitch currently\n";
+ } elsif ($changes && $changes =~ /^\s*(?:[+-])?\s*(ovs_type|allow-ovs)/mi) {
+ die "Changes include OpenVSwitch interfaces, but ifupdown2 ".
+ "reload is not compatible with openvswitch currently\n";
+ }
+ }
my $worker = sub {
--
2.20.1
_______________________________________________
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