Class: OsVm::MachineConfig::Disk
- Inherits:
-
Object
- Object
- OsVm::MachineConfig::Disk
- Defined in:
- lib/osvm/machine_config.rb
Instance Attribute Summary collapse
- #create ⇒ Boolean readonly
- #device ⇒ String readonly
- #size ⇒ String readonly
- #type ⇒ 'file', 'blockdev' readonly
Instance Method Summary collapse
-
#initialize(cfg) ⇒ Disk
constructor
A new instance of Disk.
Constructor Details
#initialize(cfg) ⇒ Disk
Returns a new instance of Disk.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/osvm/machine_config.rb', line 36 def initialize(cfg) @device = cfg.fetch(:device) @type = cfg.fetch(:type) unless %w[file blockdev].include?(@type) raise ArgumentError, "unsupported disk type #{@type.inspect}" end @size = cfg.fetch(:size) @create = cfg.fetch(:create, true) end |
Instance Attribute Details
#create ⇒ Boolean (readonly)
34 35 36 |
# File 'lib/osvm/machine_config.rb', line 34 def create @create end |
#device ⇒ String (readonly)
25 26 27 |
# File 'lib/osvm/machine_config.rb', line 25 def device @device end |
#size ⇒ String (readonly)
31 32 33 |
# File 'lib/osvm/machine_config.rb', line 31 def size @size end |
#type ⇒ 'file', 'blockdev' (readonly)
28 29 30 |
# File 'lib/osvm/machine_config.rb', line 28 def type @type end |