Skip to content

Commit

Permalink
Merge pull request #432 from mchf/bnc993587-activate-ifaces-configure…
Browse files Browse the repository at this point in the history
…d-in-installer

Perform explicit device activation in case of ssh install.
  • Loading branch information
mchf committed Aug 25, 2016
2 parents f847f9a + 56cf95a commit bb8074f
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 22 deletions.
8 changes: 8 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Aug 24 10:54:55 UTC 2016 - mfilka@suse.com

- bnc#993587
- installer is able to newly configured set devices up in case of
ssh/vnc installation
- 3.1.168

-------------------------------------------------------------------
Fri Aug 19 08:59:14 UTC 2016 - mfilka@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 3.1.167
Version: 3.1.168
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
16 changes: 2 additions & 14 deletions src/lib/network/network_autoconfiguration.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# encoding: utf-8

require "yast"
require "network/wicked"

module Yast
# The class is responsible for generating / proposing automatic
# configuration during installation workflow
class NetworkAutoconfiguration
include Wicked
include Singleton
include Logger
include Yast

Yast.import "Lan"
Yast.import "LanItems"
Expand All @@ -18,8 +19,6 @@ class NetworkAutoconfiguration
Yast.import "Arch"
Yast.import "Host"

BASH_PATH = Path.new(".target.bash")

def configure_dhcp
Yast.include self, "network/routines.rb"

Expand Down Expand Up @@ -142,17 +141,6 @@ def setup_dhcp(card)
LanItems.Commit
end

# Reloads configuration for each device named in devs
#
# @devs [Array] list of device names
# @return true if configuration was reloaded
def reload_config(devs)
raise ArgumentError if devs.nil?
return true if devs.empty?

SCR.Execute(BASH_PATH, "wicked ifreload #{devs.join(" ")}") == 0
end

def delete_config(devname)
LanItems.delete_dev(devname)
end
Expand Down
20 changes: 20 additions & 0 deletions src/lib/network/wicked.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# encoding: utf-8

require "yast"

module Yast
module Wicked
BASH_PATH = Path.new(".target.bash")

# Reloads configuration for each device named in devs
#
# @devs [Array] list of device names
# @return true if configuration was reloaded
def reload_config(devs)
raise ArgumentError if devs.nil?
return true if devs.empty?

SCR.Execute(BASH_PATH, "wicked ifreload #{devs.join(" ")}").zero?
end
end
end
25 changes: 18 additions & 7 deletions src/modules/Lan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1120,17 +1120,28 @@ def HaveXenBridge
private

def activate_network_service
if LanItems.force_restart
# If the second installation stage has been called by yast.ssh via
# ssh, we should not restart network because systemctl
# hangs in that case. (bnc#885640)
action = :reload_restart if Stage.normal || !Linuxrc.usessh
action = :force_restart if LanItems.force_restart
action = :remote_installer if Stage.initial && (Linuxrc.usessh || Linuxrc.vnc)

case action
when :force_restart
log.info("Network service activation forced")
NetworkService.Restart
else
log.info "Attempting to reload network service, normal stage " \
"#{Stage.normal}, ssh: #{Linuxrc.usessh}"

# If the second installation stage has been called by yast.ssh via
# ssh, we should not restart network cause systemctl
# hangs in that case. (bnc#885640)
when :reload_restart
log.info("Attempting to reload network service, normal stage #{Stage.normal}, ssh: #{Linuxrc.usessh}")

NetworkService.ReloadOrRestart if Stage.normal || !Linuxrc.usessh

when :remote_installer
# last instance handling "special" cases like ssh installation
# FIXME: most probably not everything will be set properly
log.info("Running in ssh/vnc installer -> just setting links up")
LanItems.reload_config(LanItems.GetAllInterfaces())
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions src/modules/LanItems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
require "yast"
require "yaml"
require "network/install_inf_convertor"
require "network/wicked"

module Yast
# Does way too many things.
Expand All @@ -46,6 +47,7 @@ class LanItemsClass < Module
attr_accessor :ipoib_mode

include Logger
include Wicked

def main
Yast.import "UI"
Expand Down

0 comments on commit bb8074f

Please sign in to comment.