Hello community,

here is the log from the commit of package yast2-fcoe-client for 
openSUSE:Factory checked in at 2016-08-10 19:53:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-fcoe-client (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-fcoe-client.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-fcoe-client"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-fcoe-client/yast2-fcoe-client.changes      
2016-06-10 23:59:32.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-fcoe-client.new/yast2-fcoe-client.changes 
2016-08-10 19:54:01.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Jul 26 09:43:33 CEST 2016 - [email protected]
+
+- handle duplicate vlan ids correctly (bsc#988050)
+- 3.1.14
+
+-------------------------------------------------------------------

Old:
----
  yast2-fcoe-client-3.1.13.tar.bz2

New:
----
  yast2-fcoe-client-3.1.14.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-fcoe-client.spec ++++++
--- /var/tmp/diff_new_pack.P3mJuI/_old  2016-08-10 19:54:02.000000000 +0200
+++ /var/tmp/diff_new_pack.P3mJuI/_new  2016-08-10 19:54:02.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-fcoe-client
-Version:        3.1.13
+Version:        3.1.14
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-fcoe-client-3.1.13.tar.bz2 -> yast2-fcoe-client-3.1.14.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-fcoe-client-3.1.13/package/yast2-fcoe-client.changes 
new/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.changes
--- old/yast2-fcoe-client-3.1.13/package/yast2-fcoe-client.changes      
2016-06-07 12:48:44.000000000 +0200
+++ new/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.changes      
2016-07-27 11:40:42.000000000 +0200
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Tue Jul 26 09:43:33 CEST 2016 - [email protected]
+
+- handle duplicate vlan ids correctly (bsc#988050)
+- 3.1.14
+
+-------------------------------------------------------------------
 Tue Jun  7 10:36:05 UTC 2016 - [email protected]
 
 - Stop generating autodocs (fate#320356)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-fcoe-client-3.1.13/package/yast2-fcoe-client.spec 
new/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.spec
--- old/yast2-fcoe-client-3.1.13/package/yast2-fcoe-client.spec 2016-06-07 
12:48:44.000000000 +0200
+++ new/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.spec 2016-07-27 
11:40:42.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-fcoe-client
-Version:        3.1.13
+Version:        3.1.14
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.1.13/src/modules/FcoeClient.rb 
new/yast2-fcoe-client-3.1.14/src/modules/FcoeClient.rb
--- old/yast2-fcoe-client-3.1.13/src/modules/FcoeClient.rb      2016-06-07 
12:48:44.000000000 +0200
+++ new/yast2-fcoe-client-3.1.14/src/modules/FcoeClient.rb      2016-07-27 
11:40:42.000000000 +0200
@@ -468,6 +468,7 @@
             "< \n" +
             "------------------------------------------\n" +
             "eth1           | 500   |54:7f:ee:09:55:9f\n" +
+            "eth1           | 500   |57:9f:ea:08:34:78\n" +
             "eth15          | 2012  |54:7f:ee:04:55:9f\n" +
             "eth15          | 0     |54:7f:ee:04:55:9f\n" +
             "eth15          | 200   |54:7f:ee:04:55:8f\n" +
@@ -500,59 +501,49 @@
     #   }
     #
     def GetVlanInterfaces(net_devices, fcoe_info)
-      net_devices = deep_copy(net_devices)
-      fcoe_info = deep_copy(fcoe_info)
       vlan_info = {}
 
-      Builtins.foreach(
-        Convert.convert(net_devices, :from => "list", :to => "list <string>")
-      ) { |dev| Builtins.foreach(fcoe_info) do |line|
-        # Check whether there is a line for the given interface, e.g.
-        # eth3            | 200  | 00:0d:ec:a2:ef:00\n
-        # Get VLAN channel from second column and FCF MAC from third.
-        line = Builtins.deletechars(line, " \t")
-        columns = Builtins.splitstring(line, "|")
-        if Ops.get(columns, 0, "") == dev
-          # get VLAN and FCF MAC and add it to vlan_info
-          vlan_interface = { "vlan" => Ops.get(columns, 1, ""), "fcf" => 
Ops.get(columns, 2, "") }
-
-          Builtins.y2milestone(
-            "Interface: %1 VLAN: %2 FCF: %3",
-            dev,
-            Ops.get(columns, 1, ""),
-            Ops.get(columns, 2, "")
-          )
-
-          if Ops.get(vlan_info, dev, []) == []
-            vlan_info = Builtins.add(vlan_info, dev, [vlan_interface])
-          else
-            vlans = Convert.convert(
-              Ops.get(vlan_info, dev, []),
-              :from => "list",
-              :to   => "list <map>"
-            )
-
-            # add vlan_interface only if no entry with identical FCF MAC exists
-            if Builtins.find(vlans) do |vlan|
-                (vlan["fcf"] || "") == (vlan_interface["fcf"] || "")
+      net_devices.each { |dev| fcoe_info.each do |line|
+          # Check whether there is a line for the given interface, e.g.
+          # eth3            | 200  | 00:0d:ec:a2:ef:00\n
+          line.delete!(" \t")
+          columns = line.split("|")
+
+          if columns[0] == dev
+            vlan_interface = {"vlan" => columns[1] || "", "fcf" => columns[2] 
|| ""}
+            log.info "Interface: #{dev} VLAN: #{columns[1]} FCF: #{columns[2]}"
+
+            vlans = vlan_info[dev] || []
+
+            # Do not add entries with identical VLAN IDs (bsc#988050).
+            # The FCF MAC adress might be identical. It's the address which
+            # can be reached via the FCoE interface and it's possible to
+            # reach same FCF MAC address from different VLANs.
+            if vlans.find_index do |vlan|
+                (vlan["vlan"] || "") == (vlan_interface["vlan"] || "")
               end == nil
-              vlans = Builtins.add(vlans, vlan_interface)
-            elsif (vlan_interface["vlan"] || "") == "0" # for VLAN = 0 replace 
existing entry
-              # VLAN = 0 'wins' (see bnc #813621, comment #4)
-              vlans = Builtins.maplist(vlans) do |vlan|
-                if (vlan["fcf"] || "") == (vlan_interface["fcf"] || "")
-                  Builtins.y2milestone("VLAN = 0 is taken")
-                  Ops.set(vlan, "vlan", "0")
-                end
-                deep_copy(vlan)
+              vlans << vlan_interface
+            end
+
+            # Check for VLAN ID "0" which is treated special:
+            # if there are other VLANs with the same FCF MAC address,
+            # only the "0" ID should be in the list (bnc #813621, comment #4)
+            fcf_zero = ""
+            vlans.each do |vlan|
+              if vlan["vlan"] == "0"
+                fcf_zero = vlan["fcf"] || ""
               end
             end
-            Ops.set(vlan_info, dev, vlans)
+            if !fcf_zero.empty?
+              vlans.delete_if { |vlan| (vlan["fcf"] == fcf_zero) &&
+                                       (vlan["vlan"] != "0") }
+            end
+            vlan_info[dev] = vlans
           end
-        end
-      end }
-      Builtins.y2milestone("VLAN info: %1", vlan_info)
-      deep_copy(vlan_info)
+        end }
+
+      log.info "VLAN info: #{vlan_info}"
+      vlan_info
     end
 
     #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-fcoe-client-3.1.13/test/GetVlanInterfaces_spec.rb 
new/yast2-fcoe-client-3.1.14/test/GetVlanInterfaces_spec.rb
--- old/yast2-fcoe-client-3.1.13/test/GetVlanInterfaces_spec.rb 2016-06-07 
12:48:44.000000000 +0200
+++ new/yast2-fcoe-client-3.1.14/test/GetVlanInterfaces_spec.rb 2016-07-27 
11:40:42.000000000 +0200
@@ -8,21 +8,57 @@
   end
   
   describe "#GetVlanInterfaces" do
-    context "with valid arguments" do
-      it "returns map containing info about vlan interfaces per netcard" do
+    context "with a list of netcards and a list of corresponding VLANs as 
arguments" do
+      it "returns info about VLAN interfaces per netcard (without identical 
VLAN IDs)" do
         expect(@fcoe.GetVlanInterfaces(["eth0", "eth1", "eth2"],
                                        ["eth0     | 200  | 00:0d:ec:a2:ef:00",
                                         "eth0     | 300  | 00:0d:ec:a2:ef:01",
-                                        "eth2     | 200  | 00:0d:ec:a2:ef:02" 
])).to eq(
+                                        "eth0     | 300  | 00:0d:ec:a2:ef:02",
+                                        "eth1     | 400  | 00:ef:af:34:12:ae",
+                                        "eth1     | 400  | 00:ef:af:34:12:af",
+                                        "eth2     | 200  | 00:0d:ec:a2:ef:03" 
])).to eq(
                       {"eth0" => [{ "vlan" => "200", "fcf" => 
"00:0d:ec:a2:ef:00" },
                                   { "vlan" => "300", "fcf" => 
"00:0d:ec:a2:ef:01" }],
-                       "eth2" => [{ "vlan" => "200", "fcf" => 
"00:0d:ec:a2:ef:02" }]
+                       "eth1" => [{ "vlan" => "400", "fcf" => 
"00:ef:af:34:12:ae" }],
+                       "eth2" => [{ "vlan" => "200", "fcf" => 
"00:0d:ec:a2:ef:03" }]
                       })
       end
     end
   end
+
   describe "#GetVlanInterfaces" do
-    context "with an empty list as argument" do
+    context "with a list of netcards and a list of VLANs including '0' VLAN as 
arguments" do
+      it "returns info about VLAN interfaces per netcard (only '0' VLAN for 
identical FCFs)" do
+        expect(@fcoe.GetVlanInterfaces(["eth0", "eth1", "eth2"],
+                                       ["eth0     | 200  | 00:0d:ec:a2:ef:00",
+                                        "eth0     | 300  | 00:0d:ec:a2:ef:01",
+                                        "eth1     | 2016 | 00:ef:af:34:12:ae",
+                                        "eth1     | 0    | 00:ef:af:34:12:ae",
+                                        "eth2     | 200  | 00:0d:ec:a2:ef:03" 
])).to eq(
+                      {"eth0" => [{ "vlan" => "200", "fcf" => 
"00:0d:ec:a2:ef:00" },
+                                  { "vlan" => "300", "fcf" => 
"00:0d:ec:a2:ef:01" }],
+                       "eth1" => [{ "vlan" => "0", "fcf" => 
"00:ef:af:34:12:ae" }],
+                       "eth2" => [{ "vlan" => "200", "fcf" => 
"00:0d:ec:a2:ef:03" }]
+                      })
+      end
+    end
+  end
+
+  describe "#GetVlanInterfaces" do
+    context "with a list of netcards and a list of VLANs but not for every 
netcard" do
+      it "returns a map containing info about VLAN interfaces only for netcard 
having VLANs" do
+        expect(@fcoe.GetVlanInterfaces(["eth0", "eth1", "eth2"],
+                                       ["eth0     | 200  | 00:0d:ec:a2:ef:00",
+                                        "eth0     | 300  | 00:0d:ec:a2:ef:01" 
])).to eq(
+                      {"eth0" => [{ "vlan" => "200", "fcf" => 
"00:0d:ec:a2:ef:00" },
+                                  { "vlan" => "300", "fcf" => 
"00:0d:ec:a2:ef:01" }]
+                      })
+      end
+    end
+  end
+
+  describe "#GetVlanInterfaces" do
+    context "with an empty list of VLANs as argument" do
       it "returns an empty map" do
         expect(@fcoe.GetVlanInterfaces(["eth0", "eth1", "eth2"], [])).to eq({})
       end


Reply via email to