Class: OsVm::MachineConfig::Network
- Inherits:
-
Object
- Object
- OsVm::MachineConfig::Network
show all
- Defined in:
- lib/osvm/machine_config.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(i, cfg) ⇒ Network
Returns a new instance of Network.
74
75
76
77
78
79
80
81
82
|
# File 'lib/osvm/machine_config.rb', line 74
def initialize(i, cfg)
@index = i
@type = cfg.fetch('type')
@opts = cfg.fetch('opts', {
'network' => '10.0.2.0/24',
'host' => '10.0.2.2',
'dns' => '10.0.2.3'
})
end
|
Instance Attribute Details
#index ⇒ Integer
69
70
71
|
# File 'lib/osvm/machine_config.rb', line 69
def index
@index
end
|
#type ⇒ String
72
73
74
|
# File 'lib/osvm/machine_config.rb', line 72
def type
@type
end
|
Class Method Details
.from_config(i, cfg) ⇒ Network
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/osvm/machine_config.rb', line 51
def self.from_config(i, cfg)
type = cfg.fetch('type')
klass =
case type
when 'user'
UserNetwork
when 'socket'
SocketNetwork
when 'bridge'
BridgeNetwork
else
raise ArgumentError, "unknown network type #{type.inspect}"
end
klass.new(i, cfg)
end
|
Instance Method Details
#qemu_options ⇒ Object
84
85
86
|
# File 'lib/osvm/machine_config.rb', line 84
def qemu_options
raise NotImplementedError
end
|