Class: ForemanAP::Volume

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman_vm/volume.rb

Overview

A disk volume attached to a virtual machine.

Instance Method Summary collapse

Constructor Details

#initialize(pool, name) ⇒ Volume

Returns a new instance of Volume.



20
21
22
23
24
# File 'lib/foreman_vm/volume.rb', line 20

def initialize(pool, name)
  @pool = pool
  @name = name
  @vol = pool.lookup_volume_by_name(name)
end

Instance Method Details

#deleteObject

Delete the volume.



15
16
17
18
# File 'lib/foreman_vm/volume.rb', line 15

def delete
  @vol.delete
  true
end

#formatObject

The format of the volume. Currently, only :raw is supported.



5
6
7
8
9
10
11
12
# File 'lib/foreman_vm/volume.rb', line 5

def format
  case @vol.info.type
  when 0
    :raw
  else
    raise 'unknown volume type: ' + @sph.info.type
  end
end