2012-01-10 17:20:56 -05:00
|
|
|
module Fog
|
|
|
|
module Storage
|
|
|
|
class IBM
|
|
|
|
class Real
|
|
|
|
|
2011-04-27 01:49:05 -04:00
|
|
|
# Requests a new Storage Volume be created.
|
2012-01-10 17:20:56 -05:00
|
|
|
#
|
2011-04-27 01:49:05 -04:00
|
|
|
# ==== Parameters
|
|
|
|
# * name<~String> - The alias to use to referance storage volume
|
|
|
|
# * offeringID<~String> - offering id can be requested from /computecloud/enterprise/api/rest/20100331/offerings/storage
|
|
|
|
# * format<~String> - filesystem format for volume
|
|
|
|
# * location<~String> - datacenter location for volume
|
|
|
|
# * size<~String> - size of volume desired (Small, Medium, Large) (varies by location what size actually is)
|
|
|
|
# * storageAreaID<~String> - (not supported yet)
|
|
|
|
#
|
|
|
|
# === Returns
|
2012-01-10 17:20:56 -05:00
|
|
|
# * response<~Excon::Response>:
|
2011-04-27 01:49:05 -04:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * name<~String> - The alias to use to referance storage volume
|
|
|
|
# * format<~String> - filesystem format for storage
|
|
|
|
# * location<~String> - datacenter location for storage
|
|
|
|
# * createdTime<~Integer> - Epoch time of creation
|
|
|
|
# * size<~String> - size of storage desired (Small, Medium, Large) (varies by location what size actually is)
|
|
|
|
# * productCodes<~Array> -
|
|
|
|
# * offeringID<~String> - offering id can be requested from /computecloud/enterprise/api/rest/20100331/offerings/storage
|
|
|
|
# * id<~String> - id of new storage
|
|
|
|
# * owner<~String> - owner of new storage
|
|
|
|
# * state<~Integer> - state of newly requested storage
|
2012-01-17 16:34:47 -05:00
|
|
|
def create_volume(name, offering_id, format, location_id, size)
|
|
|
|
request(
|
2012-01-10 17:20:56 -05:00
|
|
|
:method => 'POST',
|
|
|
|
:expects => 200,
|
|
|
|
:path => '/storage',
|
2012-01-17 16:34:47 -05:00
|
|
|
:body => {
|
|
|
|
'name' => name,
|
|
|
|
'offeringID' => offering_id,
|
|
|
|
'format' => format,
|
|
|
|
'location' => location_id,
|
|
|
|
'size' => size
|
|
|
|
}
|
|
|
|
)
|
2012-01-10 17:20:56 -05:00
|
|
|
end
|
2011-12-02 13:27:44 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
|
|
|
def create_volume(name, offering_id, format, location_id, size)
|
|
|
|
volume = Fog::IBM::Mock.create_volume(name, format, location_id, size, offering_id)
|
|
|
|
self.data[:volumes][volume['id']] = volume
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 200
|
|
|
|
response.body = format_get_volume_response_for(volume['id'])
|
|
|
|
response
|
|
|
|
end
|
2012-01-10 17:20:56 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|