Class: OsVm::MachineConfig::SocketNetwork
- Defined in:
- lib/osvm/machine_config.rb
Instance Attribute Summary collapse
- #mcast_address ⇒ String readonly
- #mcast_port ⇒ Integer readonly
Attributes inherited from Network
Instance Method Summary collapse
-
#initialize(_i, cfg) ⇒ SocketNetwork
constructor
A new instance of SocketNetwork.
- #qemu_options ⇒ Object
Methods inherited from Network
Constructor Details
#initialize(_i, cfg) ⇒ SocketNetwork
Returns a new instance of SocketNetwork.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/osvm/machine_config.rb', line 108 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 (readonly)
103 104 105 |
# File 'lib/osvm/machine_config.rb', line 103 def mcast_address @mcast_address end |
#mcast_port ⇒ Integer (readonly)
106 107 108 |
# File 'lib/osvm/machine_config.rb', line 106 def mcast_port @mcast_port end |
Instance Method Details
#qemu_options ⇒ Object
128 129 130 131 132 133 |
# File 'lib/osvm/machine_config.rb', line 128 def [ '-device', "virtio-net,netdev=net#{index}", '-netdev', "socket,id=net#{index},mcast=#{mcast_address}:#{mcast_port}" ] end |