Method: CIMI::Service::Volume.from_storage_volume

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

.from_storage_volume(volume, context) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cimi/service/volume.rb', line 49

def self.from_storage_volume(volume, context)
  self.new(context, :values => {
    :name => volume.name || volume.id,
    :created => volume.created.nil? ? nil : Time.parse(volume.created).xmlschema,
    :id => context.volume_url(volume.id),
    :capacity => context.to_kibibyte(volume.capacity, 'GB'),
    :bootable => "false", #fixme ... will vary... ec2 doesn't expose this
    :snapshots => [], #fixme...
    :type => 'http://schemas.dmtf.org/cimi/1/mapped',
    :state => volume.state == 'IN-USE' ? 'AVAILABLE' : volume.state,
    :meters => [],
    :operations => [{:href=> context.volume_url(volume.id), :rel => "delete"}]
  })
end