Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2016-02-25 21:44:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2016-02-07 09:21:20.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2016-02-25 21:44:08.000000000 +0100 @@ -1,0 +2,12 @@ +Mon Feb 22 11:52:09 UTC 2016 - mfi...@suse.com + +- bnc#960703 + - sometimes wicked was started instead of NetworkManager in case + of AY installation. Moreover it could happen that both services + were "half-started" and network setup got broken. +- bsc#903190 + - Recognized netcard with sub_class_id 07 as InfiniBand (ib) which + now are not filtered out (knut.anders...@suse.com). +- 3.1.143 + +------------------------------------------------------------------- Old: ---- yast2-network-3.1.142.tar.bz2 New: ---- yast2-network-3.1.143.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.GLc6po/_old 2016-02-25 21:44:09.000000000 +0100 +++ /var/tmp/diff_new_pack.GLc6po/_new 2016-02-25 21:44:09.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.142 +Version: 3.1.143 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-network-3.1.142.tar.bz2 -> yast2-network-3.1.143.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.142/package/yast2-network.changes new/yast2-network-3.1.143/package/yast2-network.changes --- old/yast2-network-3.1.142/package/yast2-network.changes 2016-02-02 00:22:12.000000000 +0100 +++ new/yast2-network-3.1.143/package/yast2-network.changes 2016-02-23 09:47:14.000000000 +0100 @@ -1,4 +1,16 @@ ------------------------------------------------------------------- +Mon Feb 22 11:52:09 UTC 2016 - mfi...@suse.com + +- bnc#960703 + - sometimes wicked was started instead of NetworkManager in case + of AY installation. Moreover it could happen that both services + were "half-started" and network setup got broken. +- bsc#903190 + - Recognized netcard with sub_class_id 07 as InfiniBand (ib) which + now are not filtered out (knut.anders...@suse.com). +- 3.1.143 + +------------------------------------------------------------------- Fri Jan 29 15:21:36 UTC 2016 - knut.anders...@suse.com - Removed old testsuites tests and autotools, so yast2-testsuite diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.142/package/yast2-network.spec new/yast2-network-3.1.143/package/yast2-network.spec --- old/yast2-network-3.1.142/package/yast2-network.spec 2016-02-02 00:22:12.000000000 +0100 +++ new/yast2-network-3.1.143/package/yast2-network.spec 2016-02-23 09:47:14.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.142 +Version: 3.1.143 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.142/src/clients/save_network.rb new/yast2-network-3.1.143/src/clients/save_network.rb --- old/yast2-network-3.1.142/src/clients/save_network.rb 2016-02-02 00:22:12.000000000 +0100 +++ new/yast2-network-3.1.143/src/clients/save_network.rb 2016-02-23 09:47:14.000000000 +0100 @@ -30,6 +30,7 @@ module Yast require "network/install_inf_convertor" require "network/network_autoconfiguration" + require "network/network_autoyast" class SaveNetworkClient < Client include Logger @@ -47,9 +48,6 @@ Yast.import "Mode" Yast.import "Arch" Yast.import "Storage" - Yast.import "LanItems" - Yast.import "Profile" - Yast.import "Linuxrc" Yast.include self, "network/routines.rb" Yast.include self, "network/complex.rb" @@ -214,7 +212,11 @@ new_SCR = WFM.SCROpen("chroot=/:scr", false) WFM.SCRSetDefault(new_SCR) - ay_mode_configuration if Mode.autoinst + # this has to be done here (out of chroot) bcs: + # 1) udev agent doesn't support SetRoot + # 2) original ifcfg file is copied otherwise too. It doesn't break things itself + # but definitely not looking well ;-) + NetworkAutoYast.instance.create_udevs if Mode.autoinst # Copy DHCP client cache so that we can request the same IP (#43974). WFM.Execute( @@ -255,6 +257,8 @@ DNS.create_hostname_link + set_network_service + SCR.Execute(path(".target.bash"), "chkconfig network on") # if portmap running - start it after reboot @@ -266,59 +270,26 @@ nil end - # Applies part of AY configuration at the end of first stage - # - # Intended mainly for steps which cannot be done in AY's second stage + # Sets default network service # - # FIXME: Currently used only for applying udev rules during network - # installations (ssh, vnc, ...). It was introduced as a quick fix for - # bnc#944349, so it is currently limited only on {ssh|vnc} installations. - # Once properly analyzed and tested then starting of whole network second - # stage can be moved here. - def ay_mode_configuration - return if !Mode.autoinst - return if !(Linuxrc.usessh || Linuxrc.vnc) - - ay_profile = Profile.current - - log.info("Applying udev rules according AY profile") - - return if ay_profile.nil? || ay_profile.empty? - return if ay_profile["networking"].nil? || ay_profile["networking"].empty? - - udev_rules = ay_profile["networking"]["net-udev"] - log.info("- udev rules: #{udev_rules}") - - return if udev_rules.nil? || udev_rules.empty? - - LanItems.Read - - udev_rules.each do |rule| - name_to = rule["name"] - attr = rule["rule"] - key = rule["value"].downcase - item, matching_item = LanItems.Items.find { |_, i| i["hwinfo"]["busid"].downcase == key || i["hwinfo"]["mac"].downcase == key } - next if !matching_item - - # for logging only - name_from = matching_item["ifcfg"] || matching_item["dev_name"] - log.info("- renaming <#{name_from}> -> <#{name_to}>") - - # selecting according device name is unreliable (selects only in between configured devices) - LanItems.current = item - - # find out what attribude is currently used for setting device name and - # change it if needed. Currently mac is used by default. So, we check is it is - # the other one (busid). If no we defaults to mac. - bus_attr = LanItems.GetItemUdev("KERNELS") - current_attr = bus_attr.empty? ? "ATTR{address}" : "KERNELS" - - # make sure that we base renaming on defined attribute with value given in AY profile - LanItems.ReplaceItemUdev(current_attr, attr, key) - LanItems.rename(name_to) + # Intended for common installation only. AY is handled elswhere + def set_network_service + if Mode.autoinst + NetworkAutoYast.instance.set_network_service + return + end + + log.info("Setting network service according to product preferences") + + if Lan.UseNetworkManager + log.info("- using NetworkManager") + NetworkService.use_network_manager + else + log.info("- using wicked") + NetworkService.use_wicked end - LanItems.write + NetworkService.EnableDisableNow end # this replaces bash script create_interface diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.142/src/include/network/routines.rb new/yast2-network-3.1.143/src/include/network/routines.rb --- old/yast2-network-3.1.142/src/include/network/routines.rb 2016-02-02 00:22:12.000000000 +0100 +++ new/yast2-network-3.1.143/src/include/network/routines.rb 2016-02-23 09:47:14.000000000 +0100 @@ -324,7 +324,9 @@ return "atm" elsif subclass_id == 4 return "isdn" - elsif subclass_id == 6 + elsif subclass_id == 6 ## Should be PICMG? + return "ib" + elsif subclass_id == 7 return "ib" elsif subclass_id == 129 return "myri" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.142/src/lib/network/network_autoyast.rb new/yast2-network-3.1.143/src/lib/network/network_autoyast.rb --- old/yast2-network-3.1.142/src/lib/network/network_autoyast.rb 2016-02-02 00:22:12.000000000 +0100 +++ new/yast2-network-3.1.143/src/lib/network/network_autoyast.rb 2016-02-23 09:47:14.000000000 +0100 @@ -2,17 +2,29 @@ module Yast # Provides functionality for network AutoYaST client(s) + # + # This currently shouldn't replace *::Import methods. In other + # words it is intended for functionality which cannot be handled + # in 2nd stage properly. Typically: + # - merging configuration provided by linuxrc means and AY profile + # together + # - target network service setup (to avoid need of restarting the + # service during 2nd stage) and all other stuff which could lead + # to the need of restarting the service (e.g. device renaming) class NetworkAutoYast include Singleton + include Logger + + Yast.import "Lan" + Yast.import "LanItems" + Yast.import "Linuxrc" # Merges existing config from system into given configuration map # - # @param [Hash, nil] configurtion map + # @param [Hash, nil] configuration map # # @return updated configuration map def merge_configs(conf) - Yast.import "Lan" - # read settings from installation Lan.Read(:cache) # export settings into AY map @@ -35,6 +47,79 @@ conf end + # Creates udev rules according definition from profile + # + # FIXME: Currently used only for applying udev rules during network + # installations (ssh, vnc, ...). It was introduced as a quick fix for + # bnc#944349, so it is currently limited only on {ssh|vnc} installations. + def create_udevs + return if !Mode.autoinst + return if !(Linuxrc.usessh || Linuxrc.vnc) + + log.info("Applying udev rules according to AY profile") + + udev_rules = ay_networking_section["net-udev"] + log.info("- udev rules: #{udev_rules}") + + return if udev_rules.nil? || udev_rules.empty? + + LanItems.Read + + udev_rules.each do |rule| + name_to = rule["name"] + attr = rule["rule"] + key = rule["value"].downcase + item, matching_item = LanItems.Items.find do |_, i| + i["hwinfo"]["busid"].downcase == key || i["hwinfo"]["mac"].downcase == key + end + next if !matching_item + + # for logging only + name_from = matching_item["ifcfg"] || matching_item["dev_name"] + log.info("- renaming <#{name_from}> -> <#{name_to}>") + + # selecting according device name is unreliable (selects only in between configured devices) + LanItems.current = item + + # find out what attribude is currently used for setting device name and + # change it if needed. Currently mac is used by default. So, we check is it is + # the other one (busid). If no we defaults to mac. + bus_attr = LanItems.GetItemUdev("KERNELS") + current_attr = bus_attr.empty? ? "ATTR{address}" : "KERNELS" + + # make sure that we base renaming on defined attribute with value given in AY profile + LanItems.ReplaceItemUdev(current_attr, attr, key) + LanItems.rename(name_to) + end + + LanItems.write + end + + # Sets network service for target + def set_network_service + return if !Mode.autoinst + + log.info("Setting network service according to AY profile") + + use_network_manager = ay_networking_section["managed"] + use_network_manager = Lan.UseNetworkManager if use_network_manager.nil? + + nm_available = NetworkService.is_backend_available(:network_manager) if use_network_manager + + if use_network_manager && nm_available + log.info("- using NetworkManager") + + NetworkService.use_network_manager + else + log.info("- using wicked") + log.warn("- NetworkManager requested but not available") if use_network_manager + + NetworkService.use_wicked + end + + NetworkService.EnableDisableNow + end + private # Merges two devices map into one. @@ -105,5 +190,17 @@ instsys_routing.merge(ay_routing) end + + # Returns networking section of current AY profile + def ay_networking_section + Yast.import "Profile" + + ay_profile = Profile.current + + return {} if ay_profile.nil? || ay_profile.empty? + return {} if ay_profile["networking"].nil? + + ay_profile["networking"] + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.142/src/modules/Lan.rb new/yast2-network-3.1.143/src/modules/Lan.rb --- old/yast2-network-3.1.142/src/modules/Lan.rb 2016-02-02 00:22:12.000000000 +0100 +++ new/yast2-network-3.1.143/src/modules/Lan.rb 2016-02-23 09:47:14.000000000 +0100 @@ -675,17 +675,6 @@ DNS.Import(settings["dns"] || {}) Routing.Import(settings["routing"] || {}) - if settings["managed"] - if NetworkService.is_backend_available(:network_manager) - NetworkService.use_network_manager - else - Report.Warning(_("AutoYaST setting networking/managed: NetworkManager is not available, Wicked will be used.")) - NetworkService.use_wicked - end - else - NetworkService.use_wicked - end - @ipv6 = settings.fetch("ipv6", true) true @@ -839,28 +828,25 @@ "network", "network_manager" ) - if nm_feature == "" + + case nm_feature + when "" # compatibility: use the boolean feature # (defaults to false) nm_default = ProductFeatures.GetBooleanFeature( "network", "network_manager_is_default" ) - elsif nm_feature == "always" + when "always" nm_default = true - elsif nm_feature == "laptop" + when "laptop" nm_default = Arch.is_laptop - Builtins.y2milestone("Is a laptop: %1", nm_default) # nm_feature == "never" - else - nm_default = false + log.info("Is a laptop: #{nm_default}") end nm_installed = Package.Installed("NetworkManager") - Builtins.y2milestone( - "NetworkManager wanted: %1, installed: %2", - nm_default, - nm_installed - ) + log.info("NetworkManager wanted: #{nm_default}, installed: #{nm_installed}") + nm_default && nm_installed end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.142/test/network_autoyast_test.rb new/yast2-network-3.1.143/test/network_autoyast_test.rb --- old/yast2-network-3.1.142/test/network_autoyast_test.rb 2016-02-02 00:22:12.000000000 +0100 +++ new/yast2-network-3.1.143/test/network_autoyast_test.rb 2016-02-23 09:47:14.000000000 +0100 @@ -148,4 +148,66 @@ network_autoyast.merge_configs("dns" => {}, "routing" => {}, "devices" => {}) end end + + describe "#set_network_service" do + Yast.import "NetworkService" + Yast.import "Mode" + + let(:network_autoyast) { Yast::NetworkAutoYast.instance } + + before(:each) do + allow(Yast::Mode).to receive(:autoinst).and_return(true) + end + + def product_use_nm(nm_used) + allow(Yast::ProductFeatures) + .to receive(:GetStringFeature) + .with("network", "network_manager") + .and_return nm_used + end + + def networking_section(net_section) + allow(network_autoyast).to receive(:ay_networking_section).and_return(net_section) + end + + def nm_installed(installed) + allow(Yast::Package) + .to receive(:Installed) + .and_return installed + end + + context "in SLED product" do + before(:each) do + product_use_nm("always") + nm_installed(true) + networking_section("managed" => true) + end + + it "enables NetworkManager" do + expect(Yast::NetworkService) + .to receive(:is_backend_available) + .with(:network_manager) + .and_return true + expect(Yast::NetworkService).to receive(:use_network_manager).and_return nil + expect(Yast::NetworkService).to receive(:EnableDisableNow).and_return nil + + network_autoyast.set_network_service + end + end + + context "in SLES product" do + before(:each) do + product_use_nm("never") + nm_installed(false) + networking_section({}) + end + + it "enables wicked" do + expect(Yast::NetworkService).to receive(:use_wicked).and_return nil + expect(Yast::NetworkService).to receive(:EnableDisableNow).and_return nil + + network_autoyast.set_network_service + end + end + end end