lib/fog/openstack/requests/compute/create_volume.rb in fog-1.10.1 vs lib/fog/openstack/requests/compute/create_volume.rb in fog-1.11.0
- old
+ new
@@ -15,11 +15,11 @@
vanilla_options = ['snapshot_id']
vanilla_options.select{|o| options[o]}.each do |key|
data['volume'][key] = options[key]
end
request(
- :body => MultiJson.encode(data),
+ :body => Fog::JSON.encode(data),
:expects => [200, 202],
:method => 'POST',
:path => "os-volumes"
)
end
@@ -29,25 +29,26 @@
class Mock
def create_volume(name, description, size, options={})
response = Excon::Response.new
response.status = 202
- response.body = {
- 'volume' => {
- 'id' => Fog::Mock.random_numbers(2),
- 'display_name' => name,
- 'display_description' => description,
- 'size' => size,
- 'status' => 'creating',
- 'snapshot_id' => '4',
- 'volume_type' => nil,
- 'availability_zone' => 'nova',
- 'created_at' => Time.now,
- 'attachments' => []
- }
+ data = {
+ 'id' => Fog::Mock.random_numbers(2),
+ 'name' => name,
+ 'description' => description,
+ 'size' => size,
+ 'status' => 'creating',
+ 'snapshot_id' => '4',
+ 'volume_type' => nil,
+ 'availability_zone' => 'nova',
+ 'created_at' => Time.now,
+ 'attachments' => []
}
+ self.data[:volumes][data['id']] = data
+ response.body = { 'volume' => data }
response
end
+
end
end
end
end