Class: OsVm::MachineConfig::SocketNetwork
- Inherits:
-
Network
- Object
- Network
- OsVm::MachineConfig::SocketNetwork
show all
- Defined in:
- lib/osvm/machine_config.rb
Instance Attribute Summary collapse
Attributes inherited from Network
#index, #mac, #type
Instance Method Summary
collapse
Methods inherited from Network
#default_opts, from_config, #resolve_mac_address
Constructor Details
Returns a new instance of SocketNetwork.
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/osvm/machine_config.rb', line 127
def initialize(_i, cfg)
super
mcast = cfg.fetch('mcast', {})
@mcast_address = mcast.fetch('address', '230.0.0.1')
mcast_port = mcast.fetch('port', 'net1')
@mcast_port =
case mcast_port
when String
PortReservation.get_port(key: "mcast:#{mcast_port}")
when Integer
mcast_port
else
raise "Invalid mcast port value #{mcast_port.inspect} (expected string or a number)"
end
end
|
Instance Attribute Details
#mcast_address ⇒ String
122
123
124
|
# File 'lib/osvm/machine_config.rb', line 122
def mcast_address
@mcast_address
end
|
#mcast_port ⇒ Integer
125
126
127
|
# File 'lib/osvm/machine_config.rb', line 125
def mcast_port
@mcast_port
end
|
Instance Method Details
#qemu_options ⇒ Object
147
148
149
150
151
152
|
# File 'lib/osvm/machine_config.rb', line 147
def qemu_options
[
'-device', "virtio-net,netdev=net#{index},mac=#{mac}",
'-netdev', "socket,id=net#{index},mcast=#{mcast_address}:#{mcast_port}"
]
end
|