2012-07-30 18:22:16 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class RackspaceV2
|
|
|
|
class Real
|
|
|
|
def create_server(name, image_id, flavor_id, min_count, max_count, options = {})
|
|
|
|
data = {
|
|
|
|
'server' => {
|
|
|
|
'name' => name,
|
|
|
|
'imageRef' => image_id,
|
|
|
|
'flavorRef' => flavor_id,
|
|
|
|
'minCount' => min_count,
|
|
|
|
'maxCount' => max_count
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-08 05:13:15 -08:00
|
|
|
data['server']['metadata'] = options[:metadata] unless options[:metadata].nil?
|
2012-10-08 15:16:41 -07:00
|
|
|
data['server']['OS-DCF:diskConfig'] = options[:disk_config] unless options[:disk_config].nil?
|
2012-09-11 09:45:14 -07:00
|
|
|
data['server']['metadata'] = options[:metadata] unless options[:metadata].nil?
|
|
|
|
data['server']['personality'] = options[:personality] unless options[:personality].nil?
|
2012-07-30 18:22:16 -04:00
|
|
|
|
|
|
|
request(
|
|
|
|
:body => Fog::JSON.encode(data),
|
|
|
|
:expects => [202],
|
|
|
|
:method => 'POST',
|
|
|
|
:path => "servers"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|