Hello community,

here is the log from the commit of package yast2-fcoe-client for 
openSUSE:Factory checked in at 2013-09-16 12:52:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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      
2013-08-01 11:08:07.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-fcoe-client.new/yast2-fcoe-client.changes 
2013-09-16 12:52:02.000000000 +0200
@@ -1,0 +2,6 @@
+Sat Sep 14 10:21:11 CEST 2013 - g...@suse.de
+
+- Refactoring of ruby code (FcoeClient.rb)
+- version 3.0.1
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-fcoe-client.spec ++++++
--- /var/tmp/diff_new_pack.Nd4jf7/_old  2013-09-16 12:52:03.000000000 +0200
+++ /var/tmp/diff_new_pack.Nd4jf7/_new  2013-09-16 12:52:03.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-fcoe-client
-Version:        3.0.0
+Version:        3.0.1
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-fcoe-client-3.0.0.tar.bz2 -> yast2-fcoe-client-3.0.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/Makefile.am.common 
new/yast2-fcoe-client-3.0.1/Makefile.am.common
--- old/yast2-fcoe-client-3.0.0/Makefile.am.common      2013-07-31 
11:27:37.000000000 +0200
+++ new/yast2-fcoe-client-3.0.1/Makefile.am.common      2013-09-14 
10:32:03.000000000 +0200
@@ -15,6 +15,7 @@
 CLEANFILES = ${ybcfiles}
 DISTCLEANFILES = .dep
 
+if HAS_YCP_MODULES
 # Needs to be outside "." because of cases
 # where ycpchook contains a symlink to "."
 # Otherwise "." keeps being newer than .dep and we loop.
@@ -26,14 +27,16 @@
        ${YCPMAKEDEP} --prefix=${prefix} ${YCPCFLAGS} > ${NEWDEP}
        cat ${NEWDEP} > .dep
        rm ${NEWDEP}
+-include .dep
+endif
 
 dist-hook: check-syntax
 
 CHECK_SYNTAX = true
-check-syntax: $(client_DATA) $(ycpchook) $(ybcfiles)
-       @if test "$(filter %.ycp,client_DATA)"; then \
+check-syntax: $(client_DATA) $(module_DATA) $(ynclude_DATA) $(ydata_DATA) 
$(ycpchook) $(ybcfiles)
+       @if test "$(filter %.ycp, $(client_DATA) $(ydata_DATA))"; then \
          if $(CHECK_SYNTAX); then \
-           TO_CHECK="$(filter %.ycp,$^)"; \
+           TO_CHECK="$(filter %.ycp, $(client_DATA) $(ydata_DATA))"; \
            echo "Checking syntax of $${TO_CHECK}"; \
            if ! $(YCPC) -qE -M. -I. $(YCPCFLAGS) $${TO_CHECK}; then \
              echo "Failed. Disable by 'make ... CHECK_SYNTAX=false' at your 
own risk"; \
@@ -43,5 +46,18 @@
            echo "Syntax check disabled"; \
          fi; \
        fi
+       @if test "$(filter %.rb, $^)"; then \
+         if $(CHECK_SYNTAX); then \
+           TO_CHECK="$(filter %.rb, $^)"; \
+           echo "Checking syntax of $${TO_CHECK}"; \
+           for f in $${TO_CHECK}; do \
+             if ! ruby -c $$f > /dev/null; then \
+               echo "Failed. Disable by 'make ... CHECK_SYNTAX=false' at your 
own risk"; \
+               exit 1; \
+             fi; \
+           done; \
+         else \
+           echo "Syntax check disabled"; \
+         fi; \
+       fi
 
--include .dep
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/VERSION 
new/yast2-fcoe-client-3.0.1/VERSION
--- old/yast2-fcoe-client-3.0.0/VERSION 2013-07-31 11:27:09.000000000 +0200
+++ new/yast2-fcoe-client-3.0.1/VERSION 2013-09-14 10:31:49.000000000 +0200
@@ -1 +1 @@
-3.0.0
+3.0.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/autodocs-ycp.ami 
new/yast2-fcoe-client-3.0.1/autodocs-ycp.ami
--- old/yast2-fcoe-client-3.0.0/autodocs-ycp.ami        2013-07-31 
11:27:37.000000000 +0200
+++ new/yast2-fcoe-client-3.0.1/autodocs-ycp.ami        2013-09-14 
10:32:03.000000000 +0200
@@ -17,8 +17,11 @@
 
 htmldir = $(docdir)/$(AUTODOCS_SUBDIR)/autodocs
 
+# find all files in Yast/ subdirectory if it exists
+YARD_YAST_FILES = $(shell test -d Yast && find Yast -type f)
+
 # use nobase_ prefix to keep the directory structure
-nobase_html_DATA = index.html $(filter-out index.html, $(wildcard *.html)) 
$(wildcard js/*) $(wildcard css/*) $(wildcard Yast/*)
+nobase_html_DATA = index.html $(filter-out index.html, $(wildcard *.html)) 
$(wildcard js/*) $(wildcard css/*) $(YARD_YAST_FILES)
 CLEANFILES = $(nobase_html_DATA) pod2htm*.tmp
 
 AUTODOCS_YCP ?= $(wildcard $(srcdir)/../../src/*.ycp)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/configure 
new/yast2-fcoe-client-3.0.1/configure
--- old/yast2-fcoe-client-3.0.0/configure       2013-07-31 11:27:40.000000000 
+0200
+++ new/yast2-fcoe-client-3.0.1/configure       2013-09-14 10:32:07.000000000 
+0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for yast2-fcoe-client 3.0.0.
+# Generated by GNU Autoconf 2.69 for yast2-fcoe-client 3.0.1.
 #
 # Report bugs to <http://bugs.opensuse.org/>.
 #
@@ -579,8 +579,8 @@
 # Identity of this package.
 PACKAGE_NAME='yast2-fcoe-client'
 PACKAGE_TARNAME='yast2-fcoe-client'
-PACKAGE_VERSION='3.0.0'
-PACKAGE_STRING='yast2-fcoe-client 3.0.0'
+PACKAGE_VERSION='3.0.1'
+PACKAGE_STRING='yast2-fcoe-client 3.0.1'
 PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
 PACKAGE_URL=''
 
@@ -588,6 +588,8 @@
 ac_default_prefix=/usr
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+HAS_YCP_MODULES_FALSE
+HAS_YCP_MODULES_TRUE
 YCPC
 YCPMAKEDEP
 YCPDOC
@@ -1247,7 +1249,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures yast2-fcoe-client 3.0.0 to adapt to many kinds of 
systems.
+\`configure' configures yast2-fcoe-client 3.0.1 to adapt to many kinds of 
systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1319,7 +1321,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of yast2-fcoe-client 3.0.0:";;
+     short | recursive ) echo "Configuration of yast2-fcoe-client 3.0.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1399,7 +1401,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-yast2-fcoe-client configure 3.0.0
+yast2-fcoe-client configure 3.0.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1416,7 +1418,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by yast2-fcoe-client $as_me 3.0.0, which was
+It was created by yast2-fcoe-client $as_me 3.0.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2355,7 +2357,7 @@
 
 # Define the identity of the package.
  PACKAGE='yast2-fcoe-client'
- VERSION='3.0.0'
+ VERSION='3.0.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2478,7 +2480,7 @@
 
 
 
-VERSION="3.0.0"
+VERSION="3.0.1"
 RPMNAME="yast2-fcoe-client"
 MAINTAINER="Gabriele Mohr <g...@suse.de>"
 
@@ -2842,6 +2844,29 @@
 fi
 
 
+# handle .dep files in Makefile.am.common if any YCP module is present
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for YCP modules" >&5
+$as_echo_n "checking for YCP modules... " >&6; }
+
+# YCP module file name starts with an upper case letter
+find . -type f | grep -q "[[:upper:]][^/]*\.ycp$" && has_ycp_modules=1
+ if test -n "$has_ycp_modules"; then
+  HAS_YCP_MODULES_TRUE=
+  HAS_YCP_MODULES_FALSE='#'
+else
+  HAS_YCP_MODULES_TRUE='#'
+  HAS_YCP_MODULES_FALSE=
+fi
+
+
+if test -n "$has_ycp_modules"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+fi
+
 
 ac_config_files="$ac_config_files Makefile doc/autodocs/Makefile doc/Makefile 
src/Makefile testsuite/Makefile"
 
@@ -3007,6 +3032,10 @@
   as_fn_error $? "conditional \"CREATE_PKGCONFIG_NOARCH\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${HAS_YCP_MODULES_TRUE}" && test -z "${HAS_YCP_MODULES_FALSE}"; 
then
+  as_fn_error $? "conditional \"HAS_YCP_MODULES\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
@@ -3404,7 +3433,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by yast2-fcoe-client $as_me 3.0.0, which was
+This file was extended by yast2-fcoe-client $as_me 3.0.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3457,7 +3486,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-yast2-fcoe-client config.status 3.0.0
+yast2-fcoe-client config.status 3.0.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/configure.ac 
new/yast2-fcoe-client-3.0.1/configure.ac
--- old/yast2-fcoe-client-3.0.0/configure.ac    2013-07-31 11:27:37.000000000 
+0200
+++ new/yast2-fcoe-client-3.0.1/configure.ac    2013-09-14 10:32:03.000000000 
+0200
@@ -1,9 +1,9 @@
 dnl configure.ac for yast2-fcoe-client
 dnl
-dnl -- This file is generated by y2autoconf 2.24.7 - DO NOT EDIT! --
+dnl -- This file is generated by y2autoconf 3.0.5 - DO NOT EDIT! --
 dnl    (edit configure.ac.in or configure.in.in instead)
 
-AC_INIT(yast2-fcoe-client, 3.0.0, http://bugs.opensuse.org/, yast2-fcoe-client)
+AC_INIT(yast2-fcoe-client, 3.0.1, http://bugs.opensuse.org/, yast2-fcoe-client)
 dnl Check for presence of file 'RPMNAME'
 AC_CONFIG_SRCDIR([RPMNAME])
 
@@ -18,7 +18,7 @@
 AM_INIT_AUTOMAKE(tar-ustar -Wno-portability)
 
 dnl Important YaST2 variables
-VERSION="3.0.0"
+VERSION="3.0.1"
 RPMNAME="yast2-fcoe-client"
 MAINTAINER="Gabriele Mohr <g...@suse.de>"
 
@@ -149,6 +149,19 @@
     AC_MSG_WARN([yast2-testsuite.rpm is not installed])
 ])
 
+# handle .dep files in Makefile.am.common if any YCP module is present
+AC_MSG_CHECKING([for YCP modules])
+
+# YCP module file name starts with an upper case letter
+[find . -type f | grep -q "[[:upper:]][^/]*\.ycp$" && has_ycp_modules=1]
+AM_CONDITIONAL([HAS_YCP_MODULES], [test -n "$has_ycp_modules"])
+
+if test -n "$has_ycp_modules"; then
+  AC_MSG_RESULT([found])
+else
+  AC_MSG_RESULT([not found])
+fi
+
 
 AC_CONFIG_FILES(Makefile doc/autodocs/Makefile
 doc/Makefile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/doc/autodocs/Makefile.in 
new/yast2-fcoe-client-3.0.1/doc/autodocs/Makefile.in
--- old/yast2-fcoe-client-3.0.0/doc/autodocs/Makefile.in        2013-07-31 
11:27:41.000000000 +0200
+++ new/yast2-fcoe-client-3.0.1/doc/autodocs/Makefile.in        2013-09-14 
10:32:09.000000000 +0200
@@ -235,8 +235,11 @@
 yncludedir = @yncludedir@
 ystartupdir = @ystartupdir@
 
+# find all files in Yast/ subdirectory if it exists
+YARD_YAST_FILES = $(shell test -d Yast && find Yast -type f)
+
 # use nobase_ prefix to keep the directory structure
-nobase_html_DATA = index.html $(filter-out index.html, $(wildcard *.html)) 
$(wildcard js/*) $(wildcard css/*) $(wildcard Yast/*)
+nobase_html_DATA = index.html $(filter-out index.html, $(wildcard *.html)) 
$(wildcard js/*) $(wildcard css/*) $(YARD_YAST_FILES)
 CLEANFILES = $(nobase_html_DATA) pod2htm*.tmp
 all: all-am
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/src/Makefile.in 
new/yast2-fcoe-client-3.0.1/src/Makefile.in
--- old/yast2-fcoe-client-3.0.0/src/Makefile.in 2013-07-31 11:27:41.000000000 
+0200
+++ new/yast2-fcoe-client-3.0.1/src/Makefile.in 2013-09-14 10:32:09.000000000 
+0200
@@ -258,7 +258,7 @@
 # Needs to be outside "." because of cases
 # where ycpchook contains a symlink to "."
 # Otherwise "." keeps being newer than .dep and we loop.
-NEWDEP = ${top_builddir}/.dep.new
+@HAS_YCP_MODULES_TRUE@NEWDEP = ${top_builddir}/.dep.new
 CHECK_SYNTAX = true
 all: all-am
 
@@ -596,16 +596,17 @@
 # generate dependencies
 # two steps not to lose the file if the command fails
 # hook: create the links before we look for files
-.dep: $(wildcard *.ycp) ${ycpchook}
-       ${YCPMAKEDEP} --prefix=${prefix} ${YCPCFLAGS} > ${NEWDEP}
-       cat ${NEWDEP} > .dep
-       rm ${NEWDEP}
+@HAS_YCP_MODULES_TRUE@.dep: $(wildcard *.ycp) ${ycpchook}
+@HAS_YCP_MODULES_TRUE@ ${YCPMAKEDEP} --prefix=${prefix} ${YCPCFLAGS} > 
${NEWDEP}
+@HAS_YCP_MODULES_TRUE@ cat ${NEWDEP} > .dep
+@HAS_YCP_MODULES_TRUE@ rm ${NEWDEP}
+@HAS_YCP_MODULES_TRUE@-include .dep
 
 dist-hook: check-syntax
-check-syntax: $(client_DATA) $(ycpchook) $(ybcfiles)
-       @if test "$(filter %.ycp,client_DATA)"; then \
+check-syntax: $(client_DATA) $(module_DATA) $(ynclude_DATA) $(ydata_DATA) 
$(ycpchook) $(ybcfiles)
+       @if test "$(filter %.ycp, $(client_DATA) $(ydata_DATA))"; then \
          if $(CHECK_SYNTAX); then \
-           TO_CHECK="$(filter %.ycp,$^)"; \
+           TO_CHECK="$(filter %.ycp, $(client_DATA) $(ydata_DATA))"; \
            echo "Checking syntax of $${TO_CHECK}"; \
            if ! $(YCPC) -qE -M. -I. $(YCPCFLAGS) $${TO_CHECK}; then \
              echo "Failed. Disable by 'make ... CHECK_SYNTAX=false' at your 
own risk"; \
@@ -615,8 +616,20 @@
            echo "Syntax check disabled"; \
          fi; \
        fi
-
--include .dep
+       @if test "$(filter %.rb, $^)"; then \
+         if $(CHECK_SYNTAX); then \
+           TO_CHECK="$(filter %.rb, $^)"; \
+           echo "Checking syntax of $${TO_CHECK}"; \
+           for f in $${TO_CHECK}; do \
+             if ! ruby -c $$f > /dev/null; then \
+               echo "Failed. Disable by 'make ... CHECK_SYNTAX=false' at your 
own risk"; \
+               exit 1; \
+             fi; \
+           done; \
+         else \
+           echo "Syntax check disabled"; \
+         fi; \
+       fi
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-fcoe-client-3.0.0/src/modules/FcoeClient.rb 
new/yast2-fcoe-client-3.0.1/src/modules/FcoeClient.rb
--- old/yast2-fcoe-client-3.0.0/src/modules/FcoeClient.rb       2013-07-30 
13:33:16.000000000 +0200
+++ new/yast2-fcoe-client-3.0.1/src/modules/FcoeClient.rb       2013-09-12 
15:03:37.000000000 +0200
@@ -285,26 +285,23 @@
     end
 
     #
-    # Check whether VLAN interfaces are configured for FCoE on the switch
+    # Check whether/which VLAN interfaces are configured for FCoE on the switch
+    # (by calling command 'fipvlan').
+    # @example
+    #   $ fipvlan eth0 eth1 eth2 eth3
+    #   Fibre Channel Forwarders Discovered\n
+    #   interface      | VLAN | FCF MAC\n
+    #   ------------------------------------------\n
+    #   eth0           | 200  | 00:0d:ec:a2:ef:00\n
+    #   eth3           | 200  | 00:0d:ec:a2:ef:01\n
     #
-    # Params:
-    # string   interface       network interface card, e.g. eth3
-    # Return:
-    # string   Vlan interface number, e.g. 200
-    # Example:
-    # # fipvlan eth0 eth1 eth2 eth3
-    #Fibre Channel Forwarders Discovered
-    #interface       | VLAN | FCF MAC
-    #------------------------------------------
-    #eth0            | 200  | 00:0d:ec:a2:ef:00
-    #eth3                | 200  | 00:0d:ec:a2:ef:01
+    # @param  [List] net_devices       detected network cards
+    # @return [List] information about FcoE VLAN interfaces
     #
-    def GetVlanInterfaces(net_devices)
-      net_devices = deep_copy(net_devices)
+    def GetFcoeInfo(net_devices)
       # Add option -u (or --link_up): don't shut down interfaces
       # to be able to detect DCB state afterwards (see bnc #737683)
       vlan_cmd = "LANG=POSIX fipvlan -u"
-      vlan_info = {}
 
       if !Mode.autoinst
         vlan_cmd = Ops.add(Ops.add(vlan_cmd, " -l "), @number_of_retries)
@@ -323,28 +320,56 @@
 
       lines = []
       if !TestMode()
-        lines = Builtins.splitstring(Ops.get_string(output, "stdout", ""), 
"\n") # test data
+        lines = Builtins.splitstring(output["stdout"] || "", "\n")
       else
+        # test data
         lines = Builtins.splitstring(
           "Fibre Channel Forwarders\n" +
             "< Discovered\n" +
             "interface       | VLAN | FCF MAC\n" +
             "< \n" +
             "------------------------------------------\n" +
-            "eth1           | 500 |54:7f:ee:09:55:9f\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:9f\n" +
-            "eth1           | 301 |54:7f:ee:06:55:9f\n" +
-            "eth1           | 400 |54:7f:ee:07:55:9f\n" +
+            "eth1           | 500   |54:7f:ee:09:55:9f\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" +
+            "eth1           | 301   |54:7f:ee:06:55:9f\n" +
+            "eth1           | 400   |54:7f:ee:07:55:9f\n" +
             "\n",
           "\n"
         )
       end
+    end
+
+    #
+    # Provide information about FCoE capable VLAN interfaces for each network 
card
+    #
+    # @param [List]    net_devices     network cards
+    # @param [List]     fcoe_info       information about FCoE VLAN interfaces
+    # @return [Hash]                    assorted FCoE info per network card
+    #
+    # @example
+    #   Param net_devices:
+    #   ["eth0", "eth1", "eth2"]
+    #   Param fcoe_info:
+    #   ["eth0     | 200  | 00:0d:ec:a2:ef:00",
+    #    "eth0     | 300  | 00:0d:ec:a2:ef:01",
+    #    "eth2     | 200  | 00:0d:ec:a2:ef:02" ]
+    #   Return:
+    #   { "eth0" => [{ "vlan" => "200", "fcf" => "00:0d:ec:a2:ef:00" },
+    #                { "vlan" => "300", "fcf" => "00:0d:ec:a2:ef:01" }],
+    #     "eth1" => [],
+    #     "eth2" => [{ "vlan" => "200", "fcf" => "00:0d:ec:a2:ef:00" }]
+    #   }
+    #
+    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(lines) do |line|
+      ) { |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.
@@ -352,12 +377,8 @@
         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, "") }
-          vlan_interface = Builtins.add(
-            vlan_interface,
-            "fcf",
-            Ops.get(columns, 2, "")
-          )
+          vlan_interface = { "vlan" => Ops.get(columns, 1, ""), "fcf" => 
Ops.get(columns, 2, "") }
+
           Builtins.y2milestone(
             "Interface: %1 VLAN: %2 FCF: %3",
             dev,
@@ -376,15 +397,13 @@
 
             # add vlan_interface only if no entry with identical FCF MAC exists
             if Builtins.find(vlans) do |vlan|
-                Ops.get_string(vlan, "fcf", "") ==
-                  Ops.get(vlan_interface, "fcf", "")
+                (vlan["fcf"] || "") == (vlan_interface["fcf"] || "")
               end == nil
               vlans = Builtins.add(vlans, vlan_interface)
-            elsif Ops.get(vlan_interface, "vlan", "") == "0" # for VLAN = 0 
replace existing entry
+            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 Ops.get_string(vlan, "fcf", "") ==
-                    Ops.get(vlan_interface, "fcf", "")
+                if (vlan["fcf"] || "") == (vlan_interface["fcf"] || "")
                   Builtins.y2milestone("VLAN = 0 is taken")
                   Ops.set(vlan, "vlan", "0")
                 end
@@ -402,12 +421,10 @@
     #
     # Check whether the VLAN device is created (check entries in 
/proc/net/vlan/config)
     #
-    # Params:
-    # string   interface       network interface card, e.g. eth3
-    # string   vlan_interface  Vlan Interface configured for FCoE (on switch)
-    # Return:
-    # string   Vlan device name, e.g. eth3.200
-    # Example:
+    # @param  [String] interface network interface card, e.g. eth3
+    # @param  [String] vlan_interface   Vlan Interface configured for FCoE (on 
switch)
+    # @return [String] Vlan device name, e.g. eth3.200
+    #
     # # cat /proc/net/vlan/config
     #VLAN Dev name    | VLAN ID
     #Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
@@ -416,8 +433,10 @@
     def GetFcoeVlanInterface(interface, vlan_interface)
       vlan_device_name = ""
 
-      if TestMode() && interface != "eth15"
-        return Ops.add(Ops.add(interface, "."), vlan_interface)
+      if TestMode()
+        vlan_device_name = "#{interface}.#{vlan_interface}"
+        Builtins.y2milestone("Test mode - Returning: %1", vlan_device_name)
+        return vlan_device_name
       end
 
       command = Builtins.sformat(
@@ -505,22 +524,12 @@
         if file_exists
           AddRevertCommand(Builtins.sformat("rm %1", file_name))
           # fill status map
-          status_map = Builtins.add(
-            status_map,
-            "FCOE_ENABLE",
-            Ops.get_string(netcard, "fcoe_enable", "yes")
-          )
-          status_map = Builtins.add(
-            status_map,
-            "DCB_REQUIRED",
-            Ops.get_string(netcard, "dcb_required", "no")
-          )
-          status_map = Builtins.add(
-            status_map,
-            "AUTO_VLAN",
-            Ops.get_string(netcard, "auto_vlan", "no")
-          )
-          status_map = Builtins.add(status_map, "cfg_device", device_name)
+          status_map = {
+            "FCOE_ENABLE"  => netcard["fcoe_enable"] || "yes",
+            "DCB_REQUIRED" => netcard["dcb_required"] || "no",
+            "AUTO_VLAN"    => netcard["auto_vlan"] || "no",
+            "cfg_device"   => device_name
+          }
         else
           Builtins.y2error("Cannot create %1", file_name)
         end
@@ -537,7 +546,6 @@
     def GetFcoeStatus(vlan_device_name, device_name)
       status_map = {}
       content = ""
-      file_exists = false
       file_name = ""
       device = vlan_device_name
 
@@ -556,6 +564,13 @@
         if !FileUtils.Exists(file_name)
           # no config file found - return empty status map
           return deep_copy(status_map)
+        else
+          # check whether there is a sysconfig file for given vlan_device_name
+          file_name = "/etc/sysconfig/network/ifcfg-#{vlan_device_name}"
+          # configuration in /etc/fcoe/cfg-<device_name> doesn't belong to 
vlan_device_name
+          if !FileUtils.Exists(file_name)
+            return deep_copy(status_map)
+          end
         end
         device = device_name
       end
@@ -767,8 +782,8 @@
           SCR.Read(path(".probe.netcard")),
           :from => "any",
           :to   => "list <map>"
-        ) # test data
-      else
+        )
+      else  # test data
         netcards = [
           {
             "bus"       => "PCI",
@@ -789,6 +804,15 @@
             "device"    => "TEST Gigabit Ethernet Controller",
             "model"     => "Intel PRO/1000 MT Desktop Adapter",
             "resource"  => { "hwaddr" => [{ "addr" => "08:23:27:11:64:78" }] }
+          },
+          {
+            "bus"       => "PCI",
+            "bus_hwcfg" => "pci",
+            "class_id"  => 2,
+            "dev_name"  => "eth2",
+            "dev_names" => ["eth15"],
+            "model"     => "Intel PRO/1000 MT Desktop Adapter",
+            "resource"  => { "hwaddr" => [{ "addr" => "08:23:27:99:64:78" }] }
           }
         ]
       end
@@ -798,213 +822,130 @@
 
       net_devices = []
 
-      Builtins.foreach(netcards) do |card|
+      netcards.each do |card|
         net_devices = Builtins.add(
           net_devices,
-          Ops.get_string(card, "dev_name", "")
+          card["dev_name"] || ""
         )
       end
 
       # The 'fipvlan' command which is called in GetVlanInterfaces configures 
the interfaces itself,
       # therefore it's not needed any longer to call 'ifconfig <if> up' here.
-      vlan_info = GetVlanInterfaces(net_devices)
+      vlan_info = GetVlanInterfaces(net_devices, GetFcoeInfo(net_devices) )
+
+      netcards.each do |card|
+        device = card["dev_name"] || ""
+        dcb_capable = DCBCapable(device) # DCB capable
 
-      Builtins.foreach(netcards) do |card|
-        info_map = {}
-        fcoe_vlan_interface = ""
-        dcb_capable = ""
-        if Ops.get(vlan_info, Ops.get_string(card, "dev_name", ""), []) == []
+        if Ops.get(vlan_info, device, []).empty?
           # Interface down or FCoE not enabled on the switch - we can't do 
anything here.
           fcoe_vlan_interface = @NOT_AVAILABLE
 
           # add infos about the card
-          dcb_capable = DCBCapable(Ops.get_string(card, "dev_name", ""))
-          info_map = Builtins.add(info_map, "dcb_capable", dcb_capable) # DCB 
capable
-          info_map = Builtins.add(
-            info_map,
-            "dev_name",
-            Ops.get_string(card, "dev_name", "")
-          ) # network card, e.g. eth3
-          info_map = Builtins.add(
-            info_map,
-            "mac_addr",
-            Ops.get_string(card, ["resource", "hwaddr", 0, "addr"], "")
-          ) # MAC address
-          if Ops.get_string(card, "device", "") != ""
-            info_map = Builtins.add(
-              info_map,
-              "device",
-              Ops.get_string(card, "device", "")
-            ) # device name
-          else
-            info_map = Builtins.add(
-              info_map,
-              "device",
-              Ops.get_string(card, "model", "")
-            ) # model
-          end
-          info_map = Builtins.add(info_map, "fcoe_vlan", fcoe_vlan_interface) 
# FCoE VLAN interface, e.g. eth3.200
+          info_map = {
+            "dcb_capable"=> dcb_capable,
+            "dev_name"   => device, # network card, e.g. eth3
+            "mac_addr"   => Ops.get_string(card, ["resource", "hwaddr", 0, 
"addr"], ""), # MAC address
+            "device"     => card["device"] || card["model"] || "",
+            "fcoe_vlan"  => fcoe_vlan_interface
+          }
 
-          @network_interfaces = Builtins.add(@network_interfaces, info_map)
+          @network_interfaces = @network_interfaces << info_map
         else
           # add infos about card and VLAN interfaces
-          vlans = Ops.get(vlan_info, Ops.get_string(card, "dev_name", ""), [])
-          Builtins.foreach(
-            Convert.convert(vlans, :from => "list", :to => "list <map>")
-          ) do |vlan|
+          vlans = Ops.get(vlan_info, device, [])
+
+          vlans.each do |vlan|
+            info_map = {}
             status_map = {}
-            info_map2 = {}
-            fcoe_vlan_interface2 = ""
-            dcb_capable2 = ""
             dcb_default = ""
-            if Ops.get_string(vlan, "vlan", "") == "0"
-              # for VLAN interface "0" means start FCoE on network interface 
(without creating a VLAN
-              # i.e. there isn't an entry in /proc/net/vlan/config)
-              fcoe_vlan_interface2 = Ops.get_string(card, "dev_name", "") # 
get FCoE VLAN interface from /proc/net/vlan/config
+            vlan_if = vlan["vlan"] || ""
+
+            if vlan_if == "0"
+              # VLAN interface "0" means start FCoE on network interface 
itself (there isn't an entry in
+              # /proc/net/vlan/config, check config files instead)
+              fcoe_vlan_interface = FcoeOnInterface?(device, vlans)?device:""
             else
-              fcoe_vlan_interface2 = GetFcoeVlanInterface(
-                Ops.get_string(card, "dev_name", ""),
-                Ops.get_string(vlan, "vlan", "")
-              )
+              # get FCoE VLAN interface from /proc/net/vlan/config
+              fcoe_vlan_interface = GetFcoeVlanInterface(device, vlan_if)
             end
-            if fcoe_vlan_interface2 != ""
-              status_map = GetFcoeStatus(
-                fcoe_vlan_interface2,
-                Ops.get_string(card, "dev_name", "")
-              )
+
+            if !fcoe_vlan_interface.empty?
+              status_map = GetFcoeStatus(fcoe_vlan_interface, device)
               if status_map == {}
-                # if a 'fcoe_vlan_interface' is created for a 'vlan' != 0 
there should be
-                # a valid configuration available
-                if Ops.get_string(vlan, "vlan", "") != "0"
-                  Builtins.y2warning(
-                    "Cannot read config file for %1 in /etc/fcoe",
-                    fcoe_vlan_interface2
-                  )
-                  Report.Warning(
-                    Builtins.sformat(
-                      _(
+                # warning if no valid configuration found
+                Builtins.y2warning(
+                                   "Cannot read config file for %1 in 
/etc/fcoe",
+                                   fcoe_vlan_interface
+                                   )
+                Report.Warning(
+                  Builtins.sformat(
+                    _(
                         "Cannot read config file for %1.\n" +
                           "You may edit the settings and recreate the FCoE\n" +
                           "VLAN interface to get a valid configuration."
                       ),
-                      fcoe_vlan_interface2
+                      fcoe_vlan_interface
                     )
-                  ) # for vlan == 0 it means FCoE is not (yet) started
-                else
-                  Builtins.y2milestone("FCoE not configured")
-                end
-                # the interface isn't configured
-                fcoe_vlan_interface2 = @NOT_CONFIGURED # add additionally 
check for VLAN = 0
-              else
-                # is FCoE really configured on interface itself or configured 
for a VLAN interface?
-                if Ops.get_string(vlan, "vlan", "") == "0"
-                  Builtins.foreach(
-                    Convert.convert(
-                      vlans,
-                      :from => "list",
-                      :to   => "list <string>"
-                    )
-                  ) do |vlan_cfg_name|
-                    # no ifcfg-<if>.<vlan> written for vlan = 0 (see 
WriteSysconfigFiles() )
-                    if FileUtils.Exists(
-                        Builtins.sformat(
-                          "/etc/sysconfig/network/ifcfg-%1.%2",
-                          Ops.get_string(card, "dev_name", ""),
-                          vlan_cfg_name
-                        )
-                      )
-                      fcoe_vlan_interface2 = @NOT_CONFIGURED
-                      status_map = {}
-                    end
-                  end
-                end
-              end
+                  )
+                # set interface to NOT_CONFIGURED
+                fcoe_vlan_interface = @NOT_CONFIGURED
+              end # if status_map == {}
             else
               # FCoE VLAN interface not yet configured (status_map remains 
empty)
-              fcoe_vlan_interface2 = @NOT_CONFIGURED
-            end
-            dcb_capable2 = DCBCapable(Ops.get_string(card, "dev_name", ""))
-            info_map2 = Builtins.add(
-              info_map2,
-              "dev_name",
-              Ops.get_string(card, "dev_name", "")
-            ) # network card, e.g. eth3
-            info_map2 = Builtins.add(
-              info_map2,
-              "mac_addr",
-              Ops.get_string(card, ["resource", "hwaddr", 0, "addr"], "")
-            ) # MAC address
-            if Ops.get_string(card, "device", "") != ""
-              info_map2 = Builtins.add(
-                info_map2,
-                "device",
-                Ops.get_string(card, "device", "")
-              ) # device name
-            else
-              info_map2 = Builtins.add(
-                info_map2,
-                "device",
-                Ops.get_string(card, "model", "")
-              ) # model
-            end
-            info_map2 = Builtins.add(
-              info_map2,
-              "fcoe_vlan",
-              fcoe_vlan_interface2
-            ) # FCoE VLAN interface, e.g. eth3.200
-            # default for FCoE enable is yes
-            info_map2 = Builtins.add(
-              info_map2,
-              "fcoe_enable",
-              Ops.get(status_map, "FCOE_ENABLE", "yes")
-            ) # FCOE_ENABLE
+              fcoe_vlan_interface = @NOT_CONFIGURED
+            end # if !fcoe_vlan_interface.empty?
+
             # exception for Broadcom cards: DCB_REQUIRED should be set to "no" 
(bnc #728658)
-            if Ops.get_string(card, "driver", "") != "bnx2x" &&
-                dcb_capable2 == "yes"
+            if card["driver"] != "bnx2x" && dcb_capable == "yes"
               dcb_default = "yes"
             else
               dcb_default = "no"
             end
-            info_map2 = Builtins.add(
-              info_map2,
-              "dcb_required",
-              Ops.get(status_map, "DCB_REQUIRED", dcb_default)
-            )
-            # default is AUTO_VLAN="yes", create /etc/fcoe/cfg-ethx file 
without VLAN device in name
-            # (e.g. /etc/fcoe/cfg-eth3), see bnc #724563
-            info_map2 = Builtins.add(
-              info_map2,
-              "auto_vlan",
-              Ops.get(status_map, "AUTO_VLAN", "yes")
-            ) # AUTO_VLAN
-            info_map2 = Builtins.add(info_map2, "dcb_capable", dcb_capable2) # 
DCB capable
-            info_map2 = Builtins.add(
-              info_map2,
-              "vlan_interface",
-              Ops.get_string(vlan, "vlan", "")
-            ) # VLAN interface, e.g. 200
-            info_map2 = Builtins.add(
-              info_map2,
-              "cfg_device",
-              Ops.get(status_map, "cfg_device", "")
-            ) # part of cfg-file name, e.g. eth3.200
-            @network_interfaces = Builtins.add(@network_interfaces, info_map2)
-          end
-        end #else
-      end
+
+            info_map = {
+              "dev_name"       => device, # network card, e.g. eth3
+              "mac_addr"       => Ops.get_string(card, ["resource", "hwaddr", 
0, "addr"], ""), # MAC address
+              "device"         => card["device"] || card["model"] || "",
+              "fcoe_vlan"      => fcoe_vlan_interface, # FCoE VLAN interface, 
e.g. eth3.200
+              "fcoe_enable"    => status_map["FCOE_ENABLE"] || "yes",  # 
default for FCoE enable is yes
+              "dcb_required"   => status_map["DCB_REQUIRED"] || dcb_default,
+              "auto_vlan"      => status_map["AUTO_VLAN"] || "yes", # default 
is AUTO_VLAN="yes", see bnc #724563
+              "dcb_capable"    => dcb_capable, # DCB capable
+              "vlan_interface" => vlan["vlan"] || "", # VLAN interface, e.g. 
200
+              "cfg_device"     => status_map["cfg_device"] || "" # part of 
cfg-file name, e.g. eth3.200
+            }
+
+            @network_interfaces = @network_interfaces << info_map
+          end # do |vlan|
+        end # else
+      end # do |card|
 
       # sort the list of interfaces (eth0, eth1, eth2...)
       @network_interfaces = Builtins.sort(@network_interfaces) do |a, b|
-        Ops.less_than(
-          Ops.get_string(a, "dev_name", ""),
-          Ops.get_string(b, "dev_name", "")
-        )
+        Ops.less_than(a["dev_name"] || "", b["dev_name"] || "")
       end
 
       true
     end
 
     #
+    # Check configuration for VLAN ID = 0
+    #
+    def FcoeOnInterface?(device, vlans)
+      return false unless FileUtils.Exists("/etc/fcoe/cfg-#{device}")
+      ret = true
+        vlans.each do |vlan_cfg|
+        # no ifcfg-<if>.<vlan> written for vlan = 0 (see WriteSysconfigFiles() 
)
+        if FileUtils.Exists( 
"/etc/sysconfig/network/ifcfg-#{device}.#{vlan_cfg["vlan"] || ""}" )
+          # sysconfig file for an VLAN interface found, i.e. FCoE isn't 
configured on interface itself
+          ret = false
+        end
+      end
+      ret
+    end
+
+    #
     # Read /etc/fcoe/config
     #
     def ReadFcoeConfig

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to