Class: OsVm::MachineConfig::UserNetwork

Inherits:
Network
  • Object
show all
Defined in:
lib/osvm/machine_config.rb

Instance Attribute Summary

Attributes inherited from Network

#index, #type

Instance Method Summary collapse

Methods inherited from Network

from_config, #initialize

Constructor Details

This class inherits a constructor from OsVm::MachineConfig::Network

Instance Method Details

#qemu_optionsObject



90
91
92
93
94
95
96
97
98
# File 'lib/osvm/machine_config.rb', line 90

def qemu_options
  net_opts = "net=#{@opts.fetch('network')},host=#{@opts.fetch('host')},dns=#{@opts.fetch('dns')}"
  net_opts << ",hostfwd=#{@opts['hostForward']}" if @opts['hostForward']

  [
    '-device', "virtio-net,netdev=net#{index}",
    '-netdev', "user,id=net#{index},#{net_opts}"
  ]
end