Method: CIMI::Service::Volume.find

Defined in:
lib/cimi/service/volume.rb

.find(id, context) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cimi/service/volume.rb', line 18

def self.find(id, context)
  creds = context.credentials
  if id == :all
    volumes = context.driver.storage_volumes(creds)
    volumes.collect{ |volume| from_storage_volume(volume, context) }
  else
    volume = context.driver.storage_volumes(creds, :id => id).first
    raise CIMI::Model::NotFound unless volume
    from_storage_volume(volume, context)
  end
end