391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
# File 'lib/smartcloud.rb', line 391
def create_volume(name, location, size, offering_id=nil, format="EXT3")
if offering_id.nil?
logger.debug "Looking up volume offerings based on location: #{location} and size: #{size}"
filter_size = ( ["Small", "Medium", "Large"].include?( size )) ? size: "Storage"
offering = describe_volume_offerings(location, filter_size)
if( offering && offering.SupportedSizes.split(",").include?(size) || ["Small", "Medium", "Large"].include?( size ))
offering_id = offering.ID
else
raise "Unable to locate offering with location #{location}, size #{size}."
end
end
logger.debug "Creating volume...please wait."
result = post("/storage", :format => format, :location => location, :name => name, :size => size, :offeringID => offering_id)
result.Volume.ID
end
|