[pve-devel] applied: [PATCH pve-common 1/1] Network: tap_create|plug : sdn : use bridge_vlan

Alexandre DERUMIER aderumier at odiso.com
Mon Mar 9 00:17:56 CET 2020


I have this error with including it at top.

 pvesh ls /cluster/sdn
Undefined subroutine &PVE::Cluster::cfs_register_file called at /usr/share/perl5/PVE/Network/SDN/VnetPlugin.pm line 11.
Compilation failed in require at /usr/share/perl5/PVE/Network/SDN/Vnets.pm line 9.
BEGIN failed--compilation aborted at /usr/share/perl5/PVE/Network/SDN/Vnets.pm line 9.
Compilation failed in require at /usr/share/perl5/PVE/Network/SDN/Zones.pm line 12.
BEGIN failed--compilation aborted at /usr/share/perl5/PVE/Network/SDN/Zones.pm line 12.
Compilation failed in require at /usr/share/perl5/PVE/Network.pm line 18.
BEGIN failed--compilation aborted at /usr/share/perl5/PVE/Network.pm line 18.
Compilation failed in require at /usr/share/perl5/PVE/INotify.pm line 15.
BEGIN failed--compilation aborted at /usr/share/perl5/PVE/INotify.pm line 15.
Compilation failed in require at /usr/share/perl5/PVE/Cluster.pm line 15.
BEGIN failed--compilation aborted at /usr/share/perl5/PVE/Cluster.pm line 15.
Compilation failed in require at /usr/share/perl5/PVE/CLI/pvesh.pm line 9.
BEGIN failed--compilation aborted at /usr/share/perl5/PVE/CLI/pvesh.pm line 9.
Compilation failed in require at /usr/bin/pvesh line 6.
BEGIN failed--compilation aborted at /usr/bin/pvesh line 6



I wonder if it couldn'be be better to move the tap/veth management directly in sdn plugins and independent of historic code, 
if somebody want to create a plugin for dpdk or others vswitch for example.

what do you think about this ?

I'll need to patch qemu-server on tap plug/unplug, vm stop/start, lxc stop/start .   
(That's why I had only do this small patch first, directly in tap|veth plug|create, but I'm not too happy with this require bug)





----- Mail original -----
De: "Alexandre Derumier" <aderumier at odiso.com>
À: "Thomas Lamprecht" <t.lamprecht at proxmox.com>
Cc: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Dimanche 8 Mars 2020 23:43:39
Objet: Re: applied: [pve-devel] [PATCH pve-common 1/1] Network: tap_create|plug : sdn : use bridge_vlan

>>applied, but moved the repeating $have_sdn = 1; detection out to be module-wide. 
>>thanks! 

I'll retest it, because if I remember, I had circular depend when putting it at top. 
That's why I have put in only in the sub. 


----- Mail original ----- 
De: "Thomas Lamprecht" <t.lamprecht at proxmox.com> 
À: "pve-devel" <pve-devel at pve.proxmox.com>, "Alexandre Derumier" <aderumier at odiso.com> 
Envoyé: Samedi 7 Mars 2020 18:14:35 
Objet: applied: [pve-devel] [PATCH pve-common 1/1] Network: tap_create|plug : sdn : use bridge_vlan 

On 2/10/20 5:26 PM, Alexandre Derumier wrote: 
> find correct bridge/vlan from vnet config 
> --- 
> src/PVE/Network.pm | 34 ++++++++++++++++++++++++++++++++++ 
> 1 file changed, 34 insertions(+) 
> 
> diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm 
> index 5f40353..740c314 100644 
> --- a/src/PVE/Network.pm 
> +++ b/src/PVE/Network.pm 
> @@ -272,6 +272,17 @@ my $activate_interface = sub { 
> sub tap_create { 
> my ($iface, $bridge) = @_; 
> 
> + my $have_sdn; 
> + eval { 
> + require PVE::Network::SDN::Zones; 
> + $have_sdn = 1; 
> + }; 
> + 
> + if ($have_sdn) { 
> + my ($bridgesdn, undef) = PVE::Network::SDN::Zones::get_bridge_vlan($bridge); 
> + $bridge = $bridgesdn if $bridgesdn; 
> + } 
> + 
> die "unable to get bridge setting\n" if !$bridge; 
> 
> my $bridgemtu = &$read_bridge_mtu($bridge); 
> @@ -286,6 +297,17 @@ sub tap_create { 
> sub veth_create { 
> my ($veth, $vethpeer, $bridge, $mac) = @_; 
> 
> + my $have_sdn; 
> + eval { 
> + require PVE::Network::SDN::Zones; 
> + $have_sdn = 1; 
> + }; 
> + 
> + if ($have_sdn) { 
> + my ($bridgesdn, undef) = PVE::Network::SDN::Zones::get_bridge_vlan($bridge); 
> + $bridge = $bridgesdn if $bridgesdn; 
> + } 
> + 
> die "unable to get bridge setting\n" if !$bridge; 
> 
> my $bridgemtu = &$read_bridge_mtu($bridge); 
> @@ -377,6 +399,18 @@ my $cleanup_firewall_bridge = sub { 
> sub tap_plug { 
> my ($iface, $bridge, $tag, $firewall, $trunks, $rate) = @_; 
> 
> + my $have_sdn; 
> + eval { 
> + require PVE::Network::SDN::Zones; 
> + $have_sdn = 1; 
> + }; 
> + 
> + if ($have_sdn) { 
> + my ($bridgesdn, $tag) = PVE::Network::SDN::Zones::get_bridge_vlan($bridge); 
> + $bridge = $bridgesdn if $bridgesdn; 
> + $trunks = undef; 
> + } 
> + 
> #cleanup old port config from any openvswitch bridge 
> eval {run_command("/usr/bin/ovs-vsctl del-port $iface", outfunc => sub {}, errfunc => sub {}) }; 
> 
> 

applied, but moved the repeating $have_sdn = 1; detection out to be module-wide. 
thanks! 




More information about the pve-devel mailing list