From 49eec69f444862567582dda2031a56fd2200b836 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Wed, 13 Nov 2013 14:54:24 +0100 Subject: [PATCH 1/2] Feature #2345: Open vSwitch drivers now managed the VLAN_TAGGED_ID parameter. This parameter is not yet sent from the core. --- src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb b/src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb index c731aee9ca..a6534bc427 100644 --- a/src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb +++ b/src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb @@ -37,7 +37,10 @@ class OpenvSwitchVLAN < OpenNebulaNetwork @nic = nic # Apply VLAN - tag_vlan if @nic[:vlan] == "YES" + if @nic[:vlan] == "YES" + tag_vlan + tag_trunk_vlans + end # Prevent Mac-spoofing mac_spoofing @@ -79,6 +82,19 @@ class OpenvSwitchVLAN < OpenNebulaNetwork run cmd end + def tag_trunk_vlans + range = @nic[:vlan_tagged_id] + if range? range + ovs_vsctl_cmd = "#{COMMANDS[:ovs_vsctl]} set Port #{@nic[:tap]}" + + cmd = "#{ovs_vsctl_cmd} trunks=#{range}" + run cmd + + cmd = "#{ovs_vsctl_cmd} vlan_mode=native-untagged" + run cmd + end + end + def mac_spoofing add_flow("in_port=#{port},arp,dl_src=#{@nic[:mac]}",:drop,45000) add_flow("in_port=#{port},arp,dl_src=#{@nic[:mac]},nw_src=#{@nic[:ip]}",:normal,46000) @@ -165,6 +181,6 @@ class OpenvSwitchVLAN < OpenNebulaNetwork end def range?(range) - !range.match(/^\d+(,\d+)*$/).nil? + !range.to_s.match(/^\d+(,\d+)*$/).nil? end end From ae9e580d41f6cf7f14362eabbc7fcb649193a58e Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Fri, 15 Nov 2013 16:43:21 +0100 Subject: [PATCH 2/2] Feature #2345: add VLAN_TAGGED_ID to the list of image inherited attributes --- share/etc/oned.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/etc/oned.conf b/share/etc/oned.conf index ab1f51500e..b1e37fa22c 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -697,3 +697,5 @@ IMAGE_RESTRICTED_ATTR = "SOURCE" INHERIT_DATASTORE_ATTR = "CEPH_HOST" INHERIT_DATASTORE_ATTR = "CEPH_SECRET" + +INHERIT_VNET_ATTR = "VLAN_TAGGED_ID"