Parent

Class/Module Index [+]

Quicksearch

Fog::Rackspace::BlockStorage::Volume

Public Instance Methods

attached?() click to toggle source

Returns true if the volume is attached @return [Boolean] true if the volume is attached

# File lib/fog/rackspace/models/block_storage/volume.rb, line 59
def attached?
  state == IN_USE
end
create_snapshot(options={}) click to toggle source

Creates a snapshot from the current volume @param [Hash] options @option options [String] :display_name of snapshot @option options [String] :display_description of snapshot @option options [Boolean] :force - If set to true, snapshot will be taken even if volume is still mounted. @return [Fog::Rackspace::BlockStorage::Snapshot] @raise [Fog::Rackspace::BlockStorage::NotFound] - HTTP 404 @raise [Fog::Rackspace::BlockStorage::BadRequest] - HTTP 400 @raise [Fog::Rackspace::BlockStorage::InternalServerError] - HTTP 500 @raise [Fog::Rackspace::BlockStorage::ServiceError] @note All writes to the volume should be flushed before creating the snapshot, either by un-mounting any file systems on the volume or by detaching the volume. @see docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/POST_createSnapshot__v1__tenant_id__snapshots.html

# File lib/fog/rackspace/models/block_storage/volume.rb, line 86
def create_snapshot(options={})
  requires :identity
  service.snapshots.create(options.merge(:volume_id => identity))
end
destroy() click to toggle source

Destroys Volume @return [Boolean] returns true if volume was deleted @raise [Fog::Rackspace::BlockStorage::NotFound] - HTTP 404 @raise [Fog::Rackspace::BlockStorage::BadRequest] - HTTP 400 @raise [Fog::Rackspace::BlockStorage::InternalServerError] - HTTP 500 @raise [Fog::Rackspace::BlockStorage::ServiceError] @note You cannot delete a volume until all of its dependent snaphosts have been deleted. @see docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/DELETE_deleteVolume__v1__tenant_id__volumes.html

# File lib/fog/rackspace/models/block_storage/volume.rb, line 121
def destroy
  requires :identity
  service.delete_volume(identity)
  true
end
ready?() click to toggle source

Returns true if the volume is in a ready state @return [Boolean] returns true if volume is in a ready state

# File lib/fog/rackspace/models/block_storage/volume.rb, line 53
def ready?
  state == AVAILABLE
end
save() click to toggle source

Creates volume @raise [Fog::Rackspace::BlockStorage::IdentifierTaken] if the volume has been previously saved. @return [Boolean] returns true if volume was successfully created @raise [Fog::Rackspace::BlockStorage::NotFound] - HTTP 404 @raise [Fog::Rackspace::BlockStorage::BadRequest] - HTTP 400 @raise [Fog::Rackspace::BlockStorage::InternalServerError] - HTTP 500 @raise [Fog::Rackspace::BlockStorage::ServiceError] @note A volume object cannot be updated @see docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/POST_createVolume__v1__tenant_id__volumes.html

# File lib/fog/rackspace/models/block_storage/volume.rb, line 100
def save
  requires :size
  raise IdentifierTaken.new('Resaving may cause a duplicate volume to be created') if persisted?
  data = service.create_volume(size, {
    :display_name => display_name,
    :display_description => display_description,
    :volume_type => volume_type,
    :availability_zone => availability_zone
  })
  merge_attributes(data.body['volume'])
  true
end
snapshots() click to toggle source

Returns a list of snapshots associated with the volume @return [Fog::Rackspace::BlockStorage::Snapshots] @raise [Fog::Rackspace::BlockStorage::NotFound] - HTTP 404 @raise [Fog::Rackspace::BlockStorage::BadRequest] - HTTP 400 @raise [Fog::Rackspace::BlockStorage::InternalServerError] - HTTP 500 @raise [Fog::Rackspace::BlockStorage::ServiceError]

# File lib/fog/rackspace/models/block_storage/volume.rb, line 69
def snapshots
  service.snapshots.select { |s| s.volume_id == identity }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.