Class: OsVm::MachineConfig::Disk

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#createBoolean (readonly)

Returns:

  • (Boolean)


34
35
36
# File 'lib/osvm/machine_config.rb', line 34

def create
  @create
end

#deviceString (readonly)

Returns:

  • (String)


25
26
27
# File 'lib/osvm/machine_config.rb', line 25

def device
  @device
end

#sizeString (readonly)

Returns:

  • (String)


31
32
33
# File 'lib/osvm/machine_config.rb', line 31

def size
  @size
end

#type'file', 'blockdev' (readonly)

Returns:

  • ('file', 'blockdev')


28
29
30
# File 'lib/osvm/machine_config.rb', line 28

def type
  @type
end