Class: Y2Network::InterfaceConfigBuilders::Bonding
- Inherits:
-
Y2Network::InterfaceConfigBuilder
- Object
- Y2Network::InterfaceConfigBuilder
- Y2Network::InterfaceConfigBuilders::Bonding
- Extended by:
- Forwardable
- Includes:
- Yast::Logger
- Defined in:
- src/lib/y2network/interface_config_builders/bonding.rb
Constant Summary
Constants inherited from Y2Network::InterfaceConfigBuilder
Y2Network::InterfaceConfigBuilder::NEW_DEVICES_COUNT
Instance Attribute Summary
Attributes inherited from Y2Network::InterfaceConfigBuilder
#connection_config, #firewall_zone, #interface, #name, #newly_added, #renaming_mechanism, #type
Instance Method Summary collapse
-
#bond_options ⇒ String
current options for bonding.
- #bond_options=(value) ⇒ Object
-
#bondable_interfaces ⇒ Array<Interface>
List of interfaces usable for the bond device.
-
#initialize(config: nil) ⇒ Bonding
constructor
A new instance of Bonding.
-
#require_adaptation?(devices) ⇒ Boolean
return [Boolean] true if there is a device config that needs to be adaptated; false otherwise.
-
#save ⇒ Object
additionally it adapts configuration of devices to be included in a bonding if needed.
Methods inherited from Y2Network::InterfaceConfigBuilder
#alias_for, #aliases, #aliases=, #boot_protocol, #boot_protocol=, #configure_as_port, #driver, #driver=, #drivers, for, #hostname, #hostname=, #hwinfo, #hwinfo_from, #ifplugd_priority, #ifplugd_priority=, #ip_address, #ip_address=, #mtu, #mtu=, #name_exists?, #name_valid_characters, #newly_added?, #proposed_names, #remote_ip, #remote_ip=, #rename_interface, #renamed_interface?, #startmode=, #subnet_prefix, #subnet_prefix=, #valid_name?
Constructor Details
#initialize(config: nil) ⇒ Bonding
Returns a new instance of Bonding.
30 31 32 |
# File 'src/lib/y2network/interface_config_builders/bonding.rb', line 30 def initialize(config: nil) super(type: InterfaceType::BONDING, config: config) end |
Instance Method Details
#bond_options ⇒ String
current options for bonding
49 50 51 |
# File 'src/lib/y2network/interface_config_builders/bonding.rb', line 49 def connection_config. end |
#bond_options=(value) ⇒ Object
43 44 45 |
# File 'src/lib/y2network/interface_config_builders/bonding.rb', line 43 def (value) connection_config. = value end |
#bondable_interfaces ⇒ Array<Interface>
Returns list of interfaces usable for the bond device.
35 36 37 |
# File 'src/lib/y2network/interface_config_builders/bonding.rb', line 35 def bondable_interfaces interfaces.select { |i| bondable?(i) } end |
#require_adaptation?(devices) ⇒ Boolean
return [Boolean] true if there is a device config that needs to be adaptated; false otherwise
59 60 61 62 63 64 65 |
# File 'src/lib/y2network/interface_config_builders/bonding.rb', line 59 def require_adaptation?(devices) devices.any? do |device| next false unless yast_config.configured_interface?(device) !valid_port_config?(device) end end |
#save ⇒ Object
additionally it adapts configuration of devices to be included in a bonding if needed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'src/lib/y2network/interface_config_builders/bonding.rb', line 68 def save ports.each do |port| interface = yast_config.interfaces.by_name(port) next if valid_port_config?(port) connection = yast_config.connections.by_name(port) builder = InterfaceConfigBuilder.for(interface.type, config: connection) builder.name = interface.name builder.configure_as_port builder.startmode = "hotplug" builder.save end super end |