-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #830 from yast/builder_types
add ipoib to builder and own types
- Loading branch information
Showing
24 changed files
with
456 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require "yast" | ||
require "y2network/interface_config_builder" | ||
|
||
Yast.import "LanItems" | ||
|
||
module Y2Network | ||
module InterfaceConfigBuilders | ||
class Ib < InterfaceConfigBuilder | ||
def initialize | ||
super(type: "ib") | ||
end | ||
|
||
attr_writer :ipoib_mode | ||
|
||
def ipoib_mode | ||
@ipoib_mode ||= Yast::LanItems.ipoib_mode || "default" | ||
end | ||
|
||
def save | ||
super | ||
|
||
Yast::LanItems.ipoib_mode = ipoib_mode == "default" ? nil : ipoib_mode | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require "yast" | ||
require "y2network/interface_config_builder" | ||
|
||
Yast.import "LanItems" | ||
Yast.import "NetworkInterfaces" | ||
|
||
module Y2Network | ||
module InterfaceConfigBuilders | ||
class Vlan < InterfaceConfigBuilder | ||
def initialize | ||
super(type: "vlan") | ||
end | ||
|
||
def etherdevice | ||
@config["ETHERDEVICE"] | ||
end | ||
|
||
def etherdevice=(value) | ||
@config["ETHERDEVICE"] = value | ||
end | ||
|
||
# @return [Hash<String, String>] returns ordered list of devices that can be used for vlan | ||
# Keys are ids for #etherdevice and value are label | ||
def possible_vlans | ||
res = {} | ||
# unconfigured devices | ||
Yast::LanItems.Items.each_value do |lan_item| | ||
next unless (lan_item["ifcfg"] || "").empty? | ||
dev_name = lan_item.fetch("hwinfo", {}).fetch("dev_name", "") | ||
res[dev_name] = dev_name | ||
end | ||
# configured devices | ||
configurations = Yast::NetworkInterfaces.FilterDevices("netcard") | ||
# TODO: API looks horrible | ||
Yast::NetworkInterfaces.CardRegex["netcard"].split("|").each do |devtype| | ||
(configurations[devtype] || {}).each_key do |devname| | ||
next if Yast::NetworkInterfaces.GetType(devname) == type | ||
|
||
res[devname] = "#{devname} - #{Yast::Ops.get_string(configurations, [devtype, devname, "NAME"], "")}" | ||
end | ||
end | ||
|
||
res | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.