Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2022-08-23 14:25:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Tue Aug 23 14:25:52 2022 rev:484 rq:992226 version:4.5.5 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2022-07-06 15:41:42.958492158 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.2083/yast2-network.changes 2022-08-23 14:26:27.347200908 +0200 @@ -1,0 +2,7 @@ +Thu Jul 21 08:38:40 UTC 2022 - Knut Anderssen <[email protected]> + +- Added a class to generate the configuration needed for a FCoE + device being aware of it during the installation (bsc#1199554) +- 4.5.5 + +------------------------------------------------------------------- Old: ---- yast2-network-4.5.4.tar.bz2 New: ---- yast2-network-4.5.5.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.mFstJj/_old 2022-08-23 14:26:27.983202307 +0200 +++ /var/tmp/diff_new_pack.mFstJj/_new 2022-08-23 14:26:27.983202307 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.5.4 +Version: 4.5.5 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.5.4.tar.bz2 -> yast2-network-4.5.5.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.4/package/yast2-network.changes new/yast2-network-4.5.5/package/yast2-network.changes --- old/yast2-network-4.5.4/package/yast2-network.changes 2022-07-05 16:04:08.000000000 +0200 +++ new/yast2-network-4.5.5/package/yast2-network.changes 2022-08-02 12:27:26.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Jul 21 08:38:40 UTC 2022 - Knut Anderssen <[email protected]> + +- Added a class to generate the configuration needed for a FCoE + device being aware of it during the installation (bsc#1199554) +- 4.5.5 + +------------------------------------------------------------------- Mon Jul 4 11:54:34 UTC 2022 - Knut Anderssen <[email protected]> - AY: Added missing route extrapara element to the networking diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.4/package/yast2-network.spec new/yast2-network-4.5.5/package/yast2-network.spec --- old/yast2-network-4.5.4/package/yast2-network.spec 2022-07-05 16:04:08.000000000 +0200 +++ new/yast2-network-4.5.5/package/yast2-network.spec 2022-08-02 12:27:26.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.5.4 +Version: 4.5.5 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.4/src/lib/y2network/fcoe_conn_generator.rb new/yast2-network-4.5.5/src/lib/y2network/fcoe_conn_generator.rb --- old/yast2-network-4.5.4/src/lib/y2network/fcoe_conn_generator.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-4.5.5/src/lib/y2network/fcoe_conn_generator.rb 2022-08-02 12:27:26.000000000 +0200 @@ -0,0 +1,78 @@ +# Copyright (c) [2022] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require "yast" +require "y2network/interface_config_builder" + +module Y2Network + # This class is responsible for creating the connection configuration for a + # given FCoE storage only device + class FcoeConnGenerator + include Yast::Logger + # @return [Y2Network::Config] + attr_reader :config + + def initialize(config) + @config = config + end + + # @param card [Hash] a hash with all the information about a network interface + def update_connections_for(card) + update_parent_connection_for(card) + update_vlan_connection_for(card) + end + + private + + # Adds or modifies the network configuration for the FCoE VLAN parent device + # + # @param card [Hash] a hash with all the information about a network interface + def update_parent_connection_for(card) + name = card.fetch("dev_name", "") + conn = config.connections.by_name(name) + builder = Y2Network::InterfaceConfigBuilder.for("eth", config: conn) + builder.name = name + builder.startmode = "nfsroot" + if conn.nil? + builder.boot_protocol = "static" + config = builder.connection_config + # FIXME: we should delegate this method to the connection_config + config.description = card.fetch("device", "") if config + end + builder.save + end + + # Adds the network configuration for the FCoE VLAN interface + # + # @param card [Hash] a hash with all the information about a network interface + def update_vlan_connection_for(card) + dev_name = card.fetch("dev_name", "") + vid = card.fetch("vlan_interface", "0").to_i + return if vid == 0 + + vlan_builder = Y2Network::InterfaceConfigBuilder.for("vlan") + vlan_builder.name = card.fetch("fcoe_vlan") + vlan_builder.etherdevice = dev_name + vlan_builder.boot_protocol = "static" + vlan_builder.startmode = "nfsroot" + vlan_builder.vlan_id = vid + vlan_builder.save + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.4/src/lib/y2network/interface_config_builder.rb new/yast2-network-4.5.5/src/lib/y2network/interface_config_builder.rb --- old/yast2-network-4.5.4/src/lib/y2network/interface_config_builder.rb 2022-07-05 16:04:08.000000000 +0200 +++ new/yast2-network-4.5.5/src/lib/y2network/interface_config_builder.rb 2022-08-02 12:27:26.000000000 +0200 @@ -66,7 +66,7 @@ attr_writer :newly_added def_delegators :@connection_config, - :startmode, :ethtool_options, :ethtool_options= + :startmode, :ethtool_options, :ethtool_options=, :description, :description= # Constructor # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.4/test/y2network/fcoe_conn_generator_test.rb new/yast2-network-4.5.5/test/y2network/fcoe_conn_generator_test.rb --- old/yast2-network-4.5.4/test/y2network/fcoe_conn_generator_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-4.5.5/test/y2network/fcoe_conn_generator_test.rb 2022-08-02 12:27:26.000000000 +0200 @@ -0,0 +1,131 @@ +#!/usr/bin/env rspec + +# Copyright (c) [2022] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require_relative "../test_helper" +require "y2network/fcoe_conn_generator" + +describe Y2Network::FcoeConnGenerator do + let(:generator) { described_class.new(config) } + let(:config) do + Y2Network::Config.new(interfaces: interfaces, connections: connections, source: :testing) + end + before do + Yast::Lan.add_config(:yast, config) + end + let(:connections) { Y2Network::ConnectionConfigsCollection.new([]) } + let(:interfaces) { Y2Network::InterfacesCollection.new([]) } + let(:netcards) do + [ + { + "auto_vlan" => "yes", + "cfg_device" => "", + "dcb_capable" => "no", + "dcb_required" => "no", + "dev_name" => "eth1", + "driver" => "fcoe", + "device" => "TEST Ethernet Controller", + "fcoe_enable" => "yes", + "fcoe_vlan" => "not configured", + "mac_addr" => "08:00:27:11:64:e4", + "vlan_interface" => "300" + }, + { + "auto_vlan" => "no", + "cfg_device" => "eth1.400", + "dcb_capable" => "no", + "dcb_required" => "yes", + "driver" => "fcoe", + "dev_name" => "eth1", + "device" => "TEST Ethernet Controller", + "fcoe_enable" => "yes", + "fcoe_vlan" => "eth1.400", + "mac_addr" => "08:00:27:11:64:e4", + "vlan_interface" => "400" + }, + { + "auto_vlan" => "yes", + "cfg_device" => "", + "dcb_capable" => "no", + "dcb_required" => "no", + "dev_name" => "eth2", + "driver" => "bnx2x", + "device" => "Intel PRO/1000 MT Desktop Adapter", + "fcoe_enable" => "yes", + "fcoe_vlan" => "not configured", + "mac_addr" => "08:23:27:99:64:78", + "vlan_interface" => "200", + "fcoe_flag" => true, + "iscsi_flag" => false, + "storage_only" => true + } + ] + end + + describe ".update_connections_for" do + let(:device) { netcards[1] } + + it "adds or updates the parent device and FCoE VLAN connection for the given device" do + expect(config.connections.size).to eql(0) + generator.update_connections_for(device) + expect(config.connections.size).to eql(2) + end + + context "when it adds the new connection for the etherdevice" do + let(:conn) { config.connections.by_name(device.fetch("dev_name")) } + + before do + generator.update_connections_for(device) + end + + it "sets the connection STARTMODE to 'nfsroot'" do + expect(conn.startmode.to_s).to eql("nfsroot") + end + + it "sets the connection BOOTPROTO to 'static'" do + expect(conn.bootproto&.name).to eql("static") + end + end + + context "when it adds the new connection for FCoE VLAN" do + let(:conn) { config.connections.by_name(device.fetch("fcoe_vlan")) } + + before do + generator.update_connections_for(device) + end + + it "sets the parent device" do + expect(conn.parent_device).to eq("eth1") + end + + it "sets the VLAN id" do + expect(conn.vlan_id).to eq(400) + end + + it "sets the connection STARTMODE to 'nfsroot'" do + expect(conn.startmode.to_s).to eql("nfsroot") + end + + it "sets the connection BOOTPROTO to 'static'" do + expect(conn.bootproto&.name).to eql("static") + end + end + end +end
