[pve-devel] [PATCH pve-manager 4/4] network api : reload : don't allow openswitch at all

Alexandre Derumier aderumier at odiso.com
Thu Jun 13 15:49:01 CEST 2019


ifupdown2 reload can't work with openswitch until we implement
ovs.

I don't think that too much users are mixing ovs && bridge anyway.

It's possible to use ifupdown2 with ovs for ifup/down with ifupdown script,
but config need to be changed, and I don't have tested too much.
(maybe add a conflict in ifupdown2 package with openvswitch package for now)

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Network.pm | 59 +--------------------------------------------
 1 file changed, 1 insertion(+), 58 deletions(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index 3c6efb11..1c8e6e56 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -541,64 +541,7 @@ __PACKAGE__->register_method({
 	my $new_config_file = "/etc/network/interfaces.new";
 
 	die "you need ifupdown2 to reload networking\n" if !-e '/usr/share/ifupdown2';
-
-	#clean-me
-	my $fh = IO::File->new("<$current_config_file");
-	my $running_config = PVE::INotify::read_etc_network_interfaces(1,$fh);
-	$fh->close();
-
-	#clean-me
-	$fh = IO::File->new("<$new_config_file");
-	my $new_config = PVE::INotify::read_etc_network_interfaces(1,$fh);
-	$fh->close();
-
-	my $ovs_changes = undef;
-	my $running_ifaces = $running_config->{ifaces};
-	my $new_ifaces = $new_config->{ifaces};
-
-	foreach my $iface (keys %$running_ifaces) {
-	    my $running_iface = $running_ifaces->{$iface};
-	    my $type = $running_iface->{type};
-	    my $new_iface = $new_ifaces->{$iface};
-	    my $new_type = $new_iface->{type};
-
-	    if ($type =~ m/^OVS/) {
-		#deleted ovs
-		$ovs_changes = 1 if !defined($new_iface);
-		#change ovs type to new type
-		$ovs_changes = 1 if $new_type ne $type;
-		#deleted or changed option
-		foreach my $iface_option (keys %$running_iface) {
-		    if (!defined($new_iface->{$iface_option}) || ($running_iface->{$iface_option} ne $new_iface->{$iface_option})) {
-			$ovs_changes = 1;
-		    }
-		}
-	    } else {
-		#change type to ovs
-		$ovs_changes = 1 if $new_type =~ m/^OVS/;
-	    }
-	}
-
-	foreach my $iface (keys %$new_ifaces) {
-	    my $new_iface = $new_ifaces->{$iface};
-	    my $new_type = $new_iface->{type};
-	    my $running_iface = $running_ifaces->{$iface};
-	    my $type = $running_iface->{type};
-
-	    if ($new_type =~ m/^OVS/) {
-		#new ovs
-		$ovs_changes = 1 if !defined($running_iface);
-		#new option
-		foreach my $iface_option (keys %$new_iface) {
-		    if (!defined($running_iface->{$iface_option})) {
-			$ovs_changes = 1;
-		    }
-		}
-	    }
-	}
-
-	die "reloading config with ovs changes is not possible currently\n"
-	    if $ovs_changes;
+	die "ifupdown2 reload is not compatible if openvswitch currently" if -x '/usr/bin/ovs-vsctl';
 
 	my $worker = sub {
 
-- 
2.20.1




More information about the pve-devel mailing list