volume can be attached to only one server at a time
# File lib/fog/hp/models/block_storage/volume.rb, line 59 def attach(new_server_id, device) requires :id unless in_use? data = service.compute.attach_volume(new_server_id, id, device) merge_attributes(:attachments => attachments << data.body['volumeAttachment']) true else false end end
# File lib/fog/hp/models/block_storage/volume.rb, line 78 def destroy requires :id service.delete_volume(id) true end
# File lib/fog/hp/models/block_storage/volume.rb, line 70 def detach requires :id if has_attachments? service.compute.detach_volume(server_id, id) end true end
a volume can be attached to only one server at a time
# File lib/fog/hp/models/block_storage/volume.rb, line 46 def has_attachments? !(attachments.nil? || attachments.empty? || attachments[0].empty?) end
used for creating bootable volumes
# File lib/fog/hp/models/block_storage/volume.rb, line 41 def image_id=(new_image_id) @image_id = new_image_id end
# File lib/fog/hp/models/block_storage/volume.rb, line 50 def in_use? self.status == 'in-use' end
# File lib/fog/hp/models/block_storage/volume.rb, line 54 def ready? self.status == 'available' end
# File lib/fog/hp/models/block_storage/volume.rb, line 84 def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :name, :size options = { 'metadata' => metadata, 'snapshot_id' => snapshot_id, 'imageRef' => @image_id } options = options.reject {|key, value| value.nil?} data = service.create_volume(name, description, size, options) merge_attributes(data.body['volume']) true end
Generated with the Darkfish Rdoc Generator 2.