class OpenStack::Nova::Volume::Volume
Attributes¶ ↑
-
display_name
-Volume
name -
display_description
-Volume
description -
volume_type
-Volume
type identifier -
size
-Volume
size (GBytes) -
availability_zone
- The availability zone for the volume -
created_at
- Creation date for the volume -
snapshot_id
- The snapshot id for the volume (not nil if this volume is a snapshot) -
status
- If the volume is a snapshot, this is the status of the snapshot (i.e. available)
Public Instance Methods
attached?()
click to toggle source
True if the volume is attached
# File lib/open_stack/nova/volume/volume.rb, line 78 def attached? !attachments.empty? end
server()
click to toggle source
The first server to which this volume is attached to (if any)
# File lib/open_stack/nova/volume/volume.rb, line 83 def server Compute::Server.find(attachments[0].server_id) if attached? end
snapshot?()
click to toggle source
True if the image is a snapshot
# File lib/open_stack/nova/volume/volume.rb, line 73 def snapshot? persisted? and snapshot_id.present? end
Protected Instance Methods
initialize(attributes = {}, persisted = false)
click to toggle source
Calls superclass method
# File lib/open_stack/nova/volume/volume.rb, line 54 def initialize(attributes = {}, persisted = false) # :notnew: attributes = attributes.with_indifferent_access new_attributes = { :id => attributes[:id], :display_name => attributes[:display_name], :display_description => attributes[:display_description], :volume_type => attributes[:volume_type], :size => attributes[:size], :status => attributes[:status], :snapshot_id => attributes[:snapshot_id], :availability_zone => attributes[:availability_zone], :attachments => attributes[:attachments] || [], :created_at => attributes[:created].present? ? DateTime.strptime(attributes[:created], OpenStack::DATETIME_FORMAT) : nil, } super(new_attributes, persisted) end