fog 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -2
- data/README.md +9 -10
- data/Rakefile +15 -299
- data/changelog.txt +153 -0
- data/docs/about/contributing.markdown +1 -0
- data/docs/dns/index.markdown +1 -1
- data/docs/index.markdown +8 -3
- data/fog.gemspec +3 -3
- data/lib/fog.rb +0 -5
- data/lib/fog/aws/auto_scaling.rb +1 -1
- data/lib/fog/aws/cloud_watch.rb +1 -1
- data/lib/fog/aws/compute.rb +2 -1
- data/lib/fog/aws/dynamodb.rb +30 -64
- data/lib/fog/aws/elb.rb +1 -1
- data/lib/fog/aws/glacier.rb +1 -1
- data/lib/fog/aws/iam.rb +1 -0
- data/lib/fog/aws/models/auto_scaling/group.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +2 -0
- data/lib/fog/aws/models/compute/volume.rb +0 -1
- data/lib/fog/aws/models/iam/user.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_instances.rb +3 -1
- data/lib/fog/aws/parsers/compute/describe_reserved_instances_offerings.rb +1 -1
- data/lib/fog/aws/parsers/storage/delete_multiple_objects.rb +50 -0
- data/lib/fog/aws/rds.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
- data/lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb +11 -8
- data/lib/fog/aws/requests/compute/modify_volume_attribute.rb +51 -0
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +1 -0
- data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +172 -0
- data/lib/fog/aws/signaturev4.rb +1 -1
- data/lib/fog/aws/sqs.rb +1 -1
- data/lib/fog/aws/storage.rb +2 -0
- data/lib/fog/bluebox/requests/compute/create_block.rb +1 -3
- data/lib/fog/brightbox/compute.rb +239 -84
- data/lib/fog/brightbox/models/compute/account.rb +9 -3
- data/lib/fog/brightbox/models/compute/server.rb +2 -1
- data/lib/fog/brightbox/models/compute/servers.rb +33 -1
- data/lib/fog/brightbox/oauth2.rb +164 -0
- data/lib/fog/brightbox/requests/compute/activate_console_server.rb +9 -2
- data/lib/fog/brightbox/requests/compute/add_listeners_load_balancer.rb +11 -2
- data/lib/fog/brightbox/requests/compute/add_nodes_load_balancer.rb +11 -2
- data/lib/fog/brightbox/requests/compute/add_servers_server_group.rb +9 -11
- data/lib/fog/brightbox/requests/compute/apply_to_firewall_policy.rb +11 -2
- data/lib/fog/brightbox/requests/compute/create_api_client.rb +11 -2
- data/lib/fog/brightbox/requests/compute/create_application.rb +11 -2
- data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +11 -1
- data/lib/fog/brightbox/requests/compute/create_firewall_policy.rb +13 -2
- data/lib/fog/brightbox/requests/compute/create_firewall_rule.rb +17 -2
- data/lib/fog/brightbox/requests/compute/create_image.rb +18 -2
- data/lib/fog/brightbox/requests/compute/create_load_balancer.rb +14 -2
- data/lib/fog/brightbox/requests/compute/create_server.rb +17 -2
- data/lib/fog/brightbox/requests/compute/create_server_group.rb +11 -2
- data/lib/fog/brightbox/requests/compute/destroy_api_client.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_application.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_cloud_ip.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_firewall_policy.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_firewall_rule.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_image.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_load_balancer.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_server.rb +9 -2
- data/lib/fog/brightbox/requests/compute/destroy_server_group.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_account.rb +7 -15
- data/lib/fog/brightbox/requests/compute/get_api_client.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_application.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_authenticated_user.rb +1 -3
- data/lib/fog/brightbox/requests/compute/get_cloud_ip.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_firewall_policy.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_firewall_rule.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_image.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_interface.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_load_balancer.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_scoped_account.rb +1 -5
- data/lib/fog/brightbox/requests/compute/get_server.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_server_group.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_server_type.rb +9 -2
- data/lib/fog/brightbox/requests/compute/get_user.rb +7 -15
- data/lib/fog/brightbox/requests/compute/get_zone.rb +9 -2
- data/lib/fog/brightbox/requests/compute/list_accounts.rb +6 -2
- data/lib/fog/brightbox/requests/compute/list_api_clients.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_applications.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_cloud_ips.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_firewall_policies.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_images.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_load_balancers.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_server_groups.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_server_types.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_servers.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_users.rb +8 -2
- data/lib/fog/brightbox/requests/compute/list_zones.rb +8 -2
- data/lib/fog/brightbox/requests/compute/map_cloud_ip.rb +11 -2
- data/lib/fog/brightbox/requests/compute/move_servers_server_group.rb +10 -12
- data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +11 -2
- data/lib/fog/brightbox/requests/compute/remove_listeners_load_balancer.rb +11 -2
- data/lib/fog/brightbox/requests/compute/remove_nodes_load_balancer.rb +11 -2
- data/lib/fog/brightbox/requests/compute/remove_servers_server_group.rb +9 -10
- data/lib/fog/brightbox/requests/compute/reset_ftp_password_account.rb +22 -3
- data/lib/fog/brightbox/requests/compute/reset_ftp_password_scoped_account.rb +18 -0
- data/lib/fog/brightbox/requests/compute/reset_secret_api_client.rb +13 -1
- data/lib/fog/brightbox/requests/compute/reset_secret_application.rb +9 -2
- data/lib/fog/brightbox/requests/compute/shutdown_server.rb +9 -2
- data/lib/fog/brightbox/requests/compute/snapshot_server.rb +9 -2
- data/lib/fog/brightbox/requests/compute/start_server.rb +9 -2
- data/lib/fog/brightbox/requests/compute/stop_server.rb +9 -2
- data/lib/fog/brightbox/requests/compute/unmap_cloud_ip.rb +9 -2
- data/lib/fog/brightbox/requests/compute/update_account.rb +32 -34
- data/lib/fog/brightbox/requests/compute/update_api_client.rb +12 -2
- data/lib/fog/brightbox/requests/compute/update_application.rb +12 -2
- data/lib/fog/brightbox/requests/compute/update_cloud_ip.rb +13 -2
- data/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +16 -1
- data/lib/fog/brightbox/requests/compute/update_image.rb +17 -2
- data/lib/fog/brightbox/requests/compute/update_load_balancer.rb +15 -2
- data/lib/fog/brightbox/requests/compute/update_scoped_account.rb +12 -19
- data/lib/fog/brightbox/requests/compute/update_server.rb +12 -2
- data/lib/fog/brightbox/requests/compute/update_server_group.rb +12 -2
- data/lib/fog/brightbox/requests/compute/update_user.rb +15 -2
- data/lib/fog/cloudstack/models/compute/server.rb +3 -1
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/connection.rb +1 -0
- data/lib/fog/google/storage.rb +13 -2
- data/lib/fog/libvirt/models/compute/server.rb +1 -0
- data/lib/fog/libvirt/requests/compute/list_domains.rb +2 -2
- data/lib/fog/openstack.rb +57 -58
- data/lib/fog/openstack/compute.rb +15 -14
- data/lib/fog/openstack/identity.rb +10 -2
- data/lib/fog/openstack/image.rb +1 -1
- data/lib/fog/openstack/models/compute/flavor.rb +5 -1
- data/lib/fog/openstack/models/compute/security_group.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +5 -0
- data/lib/fog/openstack/models/identity/users.rb +1 -2
- data/lib/fog/openstack/requests/compute/create_flavor.rb +4 -1
- data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/get_limits.rb +93 -0
- data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -0
- data/lib/fog/openstack/requests/compute/release_address.rb +13 -1
- data/lib/fog/openstack/requests/compute/reset_server_state.rb +24 -0
- data/lib/fog/openstack/requests/identity/create_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/set_tenant.rb +21 -0
- data/lib/fog/openstack/volume.rb +2 -1
- data/lib/fog/rackspace/models/compute_v2/server.rb +27 -0
- data/lib/fog/rackspace/models/compute_v2/servers.rb +8 -0
- data/lib/fog/rackspace/models/dns/record.rb +14 -1
- data/lib/fog/rackspace/models/storage/file.rb +68 -2
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +3 -0
- data/lib/fog/version.rb +5 -0
- data/lib/fog/vsphere/compute.rb +74 -8
- data/lib/fog/vsphere/models/compute/cluster.rb +31 -0
- data/lib/fog/vsphere/models/compute/clusters.rb +26 -0
- data/lib/fog/vsphere/models/compute/datacenter.rb +35 -0
- data/lib/fog/vsphere/models/compute/datacenters.rb +23 -0
- data/lib/fog/vsphere/models/compute/datastore.rb +24 -0
- data/lib/fog/vsphere/models/compute/datastores.rb +25 -0
- data/lib/fog/vsphere/models/compute/folder.rb +28 -0
- data/lib/fog/vsphere/models/compute/folders.rb +27 -0
- data/lib/fog/vsphere/models/compute/interface.rb +39 -0
- data/lib/fog/vsphere/models/compute/interfaces.rb +33 -0
- data/lib/fog/vsphere/models/compute/network.rb +21 -0
- data/lib/fog/vsphere/models/compute/networks.rb +25 -0
- data/lib/fog/vsphere/models/compute/resource_pool.rb +23 -0
- data/lib/fog/vsphere/models/compute/resource_pools.rb +26 -0
- data/lib/fog/vsphere/models/compute/server.rb +78 -12
- data/lib/fog/vsphere/models/compute/servers.rb +16 -20
- data/lib/fog/vsphere/models/compute/template.rb +13 -0
- data/lib/fog/vsphere/models/compute/templates.rb +23 -0
- data/lib/fog/vsphere/models/compute/volume.rb +45 -0
- data/lib/fog/vsphere/models/compute/volumes.rb +33 -0
- data/lib/fog/vsphere/requests/compute/create_vm.rb +114 -0
- data/lib/fog/vsphere/requests/compute/get_cluster.rb +25 -0
- data/lib/fog/vsphere/requests/compute/get_datacenter.rb +29 -0
- data/lib/fog/vsphere/requests/compute/get_datastore.rb +25 -0
- data/lib/fog/vsphere/requests/compute/get_folder.rb +73 -0
- data/lib/fog/vsphere/requests/compute/get_network.rb +25 -0
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +26 -0
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +62 -0
- data/lib/fog/vsphere/requests/compute/list_clusters.rb +37 -0
- data/lib/fog/vsphere/requests/compute/list_datacenters.rb +34 -0
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +40 -0
- data/lib/fog/vsphere/requests/compute/list_folders.rb +45 -0
- data/lib/fog/vsphere/requests/compute/list_networks.rb +38 -0
- data/lib/fog/vsphere/requests/compute/list_resource_pools.rb +39 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +132 -166
- data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +52 -0
- data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +51 -0
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +6 -8
- data/lib/fog/vsphere/requests/compute/vm_destroy.rb +1 -8
- data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +1 -2
- data/lib/tasks/changelog_task.rb +98 -0
- data/lib/tasks/documentation_task.rb +155 -0
- data/lib/tasks/test_task.rb +46 -0
- data/tests/aws/models/iam/users_tests.rb +16 -2
- data/tests/aws/requests/auto_scaling/notification_configuration_tests.rb +1 -0
- data/tests/aws/requests/auto_scaling/tag_tests.rb +1 -0
- data/tests/aws/requests/compute/instance_tests.rb +2 -0
- data/tests/aws/requests/compute/volume_tests.rb +8 -0
- data/tests/aws/requests/storage/object_tests.rb +18 -1
- data/tests/aws/requests/storage/versioning_tests.rb +70 -0
- data/tests/brightbox/compute_tests.rb +96 -4
- data/tests/brightbox/models/compute/account_tests.rb +15 -0
- data/tests/brightbox/oauth2_tests.rb +103 -0
- data/tests/brightbox/requests/compute/account_tests.rb +9 -2
- data/tests/brightbox/requests/compute/interface_tests.rb +18 -4
- data/tests/dns/models/record_tests.rb +17 -3
- data/tests/openstack/requests/compute/address_tests.rb +22 -19
- data/tests/openstack/requests/compute/flavor_tests.rb +4 -2
- data/tests/openstack/requests/compute/limit_tests.rb +60 -0
- data/tests/openstack/requests/compute/quota_tests.rb +16 -3
- data/tests/openstack/requests/compute/security_group_tests.rb +1 -1
- data/tests/rackspace/models/compute_v2/servers_tests.rb +6 -0
- data/tests/rackspace/models/storage/file_tests.rb +172 -0
- data/tests/rackspace/requests/dns/helper.rb +12 -26
- data/tests/vsphere/compute_tests.rb +3 -3
- data/tests/vsphere/models/compute/server_tests.rb +1 -2
- data/tests/vsphere/requests/compute/list_virtual_machines_tests.rb +5 -13
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +2 -2
- metadata +59 -11
- data/lib/fog/vsphere/requests/compute/datacenters.rb +0 -34
- data/lib/fog/vsphere/requests/compute/find_vm_by_ref.rb +0 -41
- data/lib/fog/vsphere/requests/compute/vm_create.rb +0 -97
- data/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb +0 -26
- data/tests/vsphere/requests/compute/vm_create_tests.rb +0 -20
@@ -69,6 +69,7 @@ module Fog
|
|
69
69
|
request :remove_fixed_ip
|
70
70
|
request :server_diagnostics
|
71
71
|
request :boot_from_snapshot
|
72
|
+
request :reset_server_state
|
72
73
|
|
73
74
|
# Server Extenstions
|
74
75
|
request :get_console_output
|
@@ -125,6 +126,7 @@ module Fog
|
|
125
126
|
# Tenant
|
126
127
|
request :list_tenants
|
127
128
|
request :set_tenant
|
129
|
+
request :get_limits
|
128
130
|
|
129
131
|
# Volume
|
130
132
|
request :list_volumes
|
@@ -189,13 +191,13 @@ module Fog
|
|
189
191
|
:addresses => {},
|
190
192
|
:quota => {
|
191
193
|
'metadata_items' => 128,
|
194
|
+
'key_pairs' => 10,
|
192
195
|
'injected_file_content_bytes' => 10240,
|
196
|
+
'injected_file_path_bytes' => 256,
|
193
197
|
'injected_files' => 5,
|
194
|
-
'gigabytes' => 1000,
|
195
198
|
'ram' => 51200,
|
196
199
|
'floating_ips' => 10,
|
197
200
|
'instances' => 10,
|
198
|
-
'volumes' => 10,
|
199
201
|
'cores' => 20,
|
200
202
|
}
|
201
203
|
}
|
@@ -249,9 +251,10 @@ module Fog
|
|
249
251
|
|
250
252
|
def initialize(options={})
|
251
253
|
@openstack_auth_token = options[:openstack_auth_token]
|
254
|
+
@auth_token = options[:openstack_auth_token]
|
252
255
|
@openstack_identity_public_endpoint = options[:openstack_identity_endpoint]
|
253
256
|
|
254
|
-
unless @
|
257
|
+
unless @auth_token
|
255
258
|
missing_credentials = Array.new
|
256
259
|
@openstack_api_key = options[:openstack_api_key]
|
257
260
|
@openstack_username = options[:openstack_username]
|
@@ -300,6 +303,7 @@ module Fog
|
|
300
303
|
response = @connection.request(params.merge({
|
301
304
|
:headers => {
|
302
305
|
'Content-Type' => 'application/json',
|
306
|
+
'Accept' => 'application/json',
|
303
307
|
'X-Auth-Token' => @auth_token
|
304
308
|
}.merge!(params[:headers] || {}),
|
305
309
|
:host => @host,
|
@@ -333,14 +337,14 @@ module Fog
|
|
333
337
|
private
|
334
338
|
|
335
339
|
def authenticate
|
336
|
-
if
|
340
|
+
if !@openstack_management_url || @openstack_must_reauthenticate
|
337
341
|
options = {
|
338
|
-
:openstack_api_key
|
339
|
-
:openstack_username
|
340
|
-
:openstack_auth_token => @
|
341
|
-
:openstack_auth_uri
|
342
|
-
:openstack_region
|
343
|
-
:openstack_tenant
|
342
|
+
:openstack_api_key => @openstack_api_key,
|
343
|
+
:openstack_username => @openstack_username,
|
344
|
+
:openstack_auth_token => @auth_token,
|
345
|
+
:openstack_auth_uri => @openstack_auth_uri,
|
346
|
+
:openstack_region => @openstack_region,
|
347
|
+
:openstack_tenant => @openstack_tenant,
|
344
348
|
:openstack_service_name => @openstack_service_name,
|
345
349
|
:openstack_identity_service_name => @openstack_identity_service_name
|
346
350
|
}
|
@@ -359,12 +363,9 @@ module Fog
|
|
359
363
|
@auth_token_expiration = credentials[:expires]
|
360
364
|
@openstack_management_url = credentials[:server_management_url]
|
361
365
|
@openstack_identity_public_endpoint = credentials[:identity_public_endpoint]
|
362
|
-
uri = URI.parse(@openstack_management_url)
|
363
|
-
else
|
364
|
-
@auth_token = @openstack_auth_token
|
365
|
-
uri = URI.parse(@openstack_management_url)
|
366
366
|
end
|
367
367
|
|
368
|
+
uri = URI.parse(@openstack_management_url)
|
368
369
|
@host = uri.host
|
369
370
|
@path, @tenant_id = uri.path.scan(/(\/.*)\/(.*)/).flatten
|
370
371
|
|
@@ -51,12 +51,16 @@ module Fog
|
|
51
51
|
request :get_role
|
52
52
|
request :list_roles
|
53
53
|
|
54
|
+
request :set_tenant
|
55
|
+
|
54
56
|
|
55
57
|
class Mock
|
56
58
|
attr_reader :auth_token
|
59
|
+
attr_reader :unscoped_token
|
57
60
|
attr_reader :auth_token_expiration
|
58
61
|
attr_reader :current_user
|
59
62
|
attr_reader :current_tenant
|
63
|
+
attr_reader :unscoped_token
|
60
64
|
|
61
65
|
def self.data
|
62
66
|
@users ||= {}
|
@@ -114,6 +118,7 @@ module Fog
|
|
114
118
|
@current_user = self.data[:users].values.find do |u|
|
115
119
|
u['name'] == @openstack_username
|
116
120
|
end
|
121
|
+
@current_tenant_id = Fog::Mock.random_hex(32)
|
117
122
|
|
118
123
|
unless @current_user
|
119
124
|
@current_user_id = Fog::Mock.random_hex(32)
|
@@ -151,6 +156,7 @@ module Fog
|
|
151
156
|
class Real
|
152
157
|
attr_reader :current_user
|
153
158
|
attr_reader :current_tenant
|
159
|
+
attr_reader :unscoped_token
|
154
160
|
|
155
161
|
def initialize(options={})
|
156
162
|
@openstack_auth_token = options[:openstack_auth_token]
|
@@ -166,7 +172,7 @@ module Fog
|
|
166
172
|
end
|
167
173
|
|
168
174
|
@openstack_tenant = options[:openstack_tenant]
|
169
|
-
@openstack_auth_uri
|
175
|
+
@openstack_auth_uri = URI.parse(options[:openstack_auth_url])
|
170
176
|
@openstack_management_url = options[:openstack_management_url]
|
171
177
|
@openstack_must_reauthenticate = false
|
172
178
|
@openstack_service_name = options[:openstack_service_name] || ['identity']
|
@@ -203,6 +209,7 @@ module Fog
|
|
203
209
|
response = @connection.request(params.merge({
|
204
210
|
:headers => {
|
205
211
|
'Content-Type' => 'application/json',
|
212
|
+
'Accept' => 'application/json',
|
206
213
|
'X-Auth-Token' => @auth_token
|
207
214
|
}.merge!(params[:headers] || {}),
|
208
215
|
:host => @host,
|
@@ -235,7 +242,7 @@ module Fog
|
|
235
242
|
private
|
236
243
|
|
237
244
|
def authenticate
|
238
|
-
if
|
245
|
+
if !@openstack_management_url || @openstack_must_reauthenticate
|
239
246
|
options = {
|
240
247
|
:openstack_api_key => @openstack_api_key,
|
241
248
|
:openstack_username => @openstack_username,
|
@@ -255,6 +262,7 @@ module Fog
|
|
255
262
|
@auth_token = credentials[:token]
|
256
263
|
@openstack_management_url = credentials[:server_management_url]
|
257
264
|
@openstack_current_user_id = credentials[:current_user_id]
|
265
|
+
@unscoped_token = credentials[:unscoped_token]
|
258
266
|
uri = URI.parse(@openstack_management_url)
|
259
267
|
else
|
260
268
|
@auth_token = @openstack_auth_token
|
data/lib/fog/openstack/image.rb
CHANGED
@@ -172,7 +172,7 @@ module Fog
|
|
172
172
|
private
|
173
173
|
|
174
174
|
def authenticate
|
175
|
-
if
|
175
|
+
if !@openstack_management_url || @openstack_must_reauthenticate
|
176
176
|
options = {
|
177
177
|
:openstack_tenant => @openstack_tenant,
|
178
178
|
:openstack_api_key => @openstack_api_key,
|
@@ -14,6 +14,8 @@ module Fog
|
|
14
14
|
attribute :swap
|
15
15
|
attribute :rxtx_factor
|
16
16
|
attribute :ephemeral, :aliases => 'OS-FLV-EXT-DATA:ephemeral'
|
17
|
+
attribute :is_public, :aliases => 'os-flavor-access:is_public'
|
18
|
+
attribute :disabled, :aliases => 'OS-FLV-DISABLED:disabled'
|
17
19
|
|
18
20
|
def initialize(attributes)
|
19
21
|
@connection = attributes[:connection]
|
@@ -23,8 +25,10 @@ module Fog
|
|
23
25
|
def save
|
24
26
|
requires :name, :ram, :vcpus, :disk
|
25
27
|
attributes[:ephemeral] = self.ephemeral || 0
|
28
|
+
attributes[:is_public] = self.is_public || false
|
29
|
+
attributes[:disabled] = self.disabled || false
|
26
30
|
attributes[:swap] = self.swap || 0
|
27
|
-
attributes[:rxtx_factor] = self.rxtx_factor || 1
|
31
|
+
attributes[:rxtx_factor] = self.rxtx_factor || 1.0
|
28
32
|
merge_attributes(connection.create_flavor(self.attributes).body['flavor'])
|
29
33
|
self
|
30
34
|
end
|
@@ -195,6 +195,11 @@ module Fog
|
|
195
195
|
connection.disassociate_address id, floating_ip
|
196
196
|
end
|
197
197
|
|
198
|
+
def reset_vm_state(vm_state)
|
199
|
+
requires :id
|
200
|
+
connection.reset_server_state id, vm_state
|
201
|
+
end
|
202
|
+
|
198
203
|
def min_count=(new_min_count)
|
199
204
|
@min_count = new_min_count
|
200
205
|
end
|
@@ -29,6 +29,7 @@ module Fog
|
|
29
29
|
'id' => attributes[:flavor_id],
|
30
30
|
'swap' => attributes[:swap],
|
31
31
|
'OS-FLV-EXT-DATA:ephemeral' => attributes[:ephemeral],
|
32
|
+
'os-flavor-access:is_public' => attributes[:is_public],
|
32
33
|
'rxtx_factor' => attributes[:rxtx_factor]
|
33
34
|
}
|
34
35
|
}
|
@@ -67,8 +68,10 @@ module Fog
|
|
67
68
|
"rel" => "bookmark"
|
68
69
|
}
|
69
70
|
],
|
70
|
-
"rxtx_factor" => attributes[:rxtx_factor] || 1,
|
71
|
+
"rxtx_factor" => attributes[:rxtx_factor] || 1.0,
|
71
72
|
"OS-FLV-EXT-DATA:ephemeral" => attributes[:ephemeral] || 0,
|
73
|
+
"os-flavor-access:is_public" => attributes[:is_public] || false,
|
74
|
+
"OS-FLV-DISABLED:disabled" => attributes[:disabled] || false,
|
72
75
|
"ram" => attributes[:ram],
|
73
76
|
"id" => "11",
|
74
77
|
"swap" => attributes[:swap] || ""
|
@@ -41,7 +41,7 @@ module Fog
|
|
41
41
|
'Content-Length' => Fog::Mock.random_numbers(3).to_s,
|
42
42
|
'Date' => Date.new}
|
43
43
|
response.body = {
|
44
|
-
'security_group' => self.data[:security_groups]
|
44
|
+
'security_group' => self.data[:security_groups][security_group_id]
|
45
45
|
}
|
46
46
|
response
|
47
47
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
|
5
|
+
# http://docs.openstack.org/api/openstack-compute/2/content/ProgramaticLimits.html
|
6
|
+
#
|
7
|
+
class Real
|
8
|
+
def get_limits
|
9
|
+
request(
|
10
|
+
:expects => 200,
|
11
|
+
:method => 'GET',
|
12
|
+
:path => '/limits.json'
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
class Mock
|
19
|
+
def get_limits
|
20
|
+
rate_limits = [
|
21
|
+
{ 'regex' => '.*',
|
22
|
+
'limit' => [
|
23
|
+
{ 'next-available' => '2012-11-22T16:13:44Z',
|
24
|
+
'unit' => 'MINUTE',
|
25
|
+
'verb' => 'POST',
|
26
|
+
'remaining' => 9,
|
27
|
+
'value' => 10 },
|
28
|
+
{ 'next-available' => '2012-11-23T00:46:14Z',
|
29
|
+
'unit' => 'MINUTE',
|
30
|
+
'verb' => 'PUT',
|
31
|
+
'remaining' => 10,
|
32
|
+
'value' => 10 },
|
33
|
+
{ 'next-available' => '2012-11-22T16:14:30Z',
|
34
|
+
'unit' => 'MINUTE',
|
35
|
+
'verb' => 'DELETE',
|
36
|
+
'remaining' => 99,
|
37
|
+
'value' => 100 } ],
|
38
|
+
'uri' => '*' },
|
39
|
+
{ 'regex' => '^/servers',
|
40
|
+
'limit' => [
|
41
|
+
{ 'next-available' => '2012-11-23T00:46:14Z',
|
42
|
+
'unit' => 'DAY',
|
43
|
+
'verb' => 'POST',
|
44
|
+
'remaining' => 50,
|
45
|
+
'value' => 50} ],
|
46
|
+
'uri'=>'*/servers' },
|
47
|
+
{ 'regex' => '.*changes-since.*',
|
48
|
+
'limit' => [
|
49
|
+
{ 'next-available' => '2012-11-23T00:46:14Z',
|
50
|
+
'unit' => 'MINUTE',
|
51
|
+
'verb' => 'GET',
|
52
|
+
'remaining' => 3,
|
53
|
+
'value' => 3 } ],
|
54
|
+
'uri' => '*changes-since*' }
|
55
|
+
]
|
56
|
+
|
57
|
+
absolute_limits = {
|
58
|
+
# Max
|
59
|
+
'maxServerMeta' => 128,
|
60
|
+
'maxTotalInstances' => 10,
|
61
|
+
'maxPersonality' => 5,
|
62
|
+
'maxImageMeta' => 128,
|
63
|
+
'maxPersonalitySize' => 10240,
|
64
|
+
'maxSecurityGroupRules' => 20,
|
65
|
+
'maxTotalKeypairs' => 100,
|
66
|
+
'maxSecurityGroups' => 10,
|
67
|
+
'maxTotalCores' => 20,
|
68
|
+
'maxTotalFloatingIps' => 10,
|
69
|
+
'maxTotalRAMSize' => 51200,
|
70
|
+
|
71
|
+
# Used
|
72
|
+
'totalCoresUsed' => -1,
|
73
|
+
'totalRAMUsed' => -2048,
|
74
|
+
'totalInstancesUsed' => -1,
|
75
|
+
'totalSecurityGroupsUsed' => 0,
|
76
|
+
'totalKeyPairsUsed' => 0
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
Excon::Response.new(
|
81
|
+
:status => 200,
|
82
|
+
:body => {
|
83
|
+
'limits' => {
|
84
|
+
'rate' => rate_limits,
|
85
|
+
'absolute' => absolute_limits }
|
86
|
+
}
|
87
|
+
)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -15,8 +15,20 @@ module Fog
|
|
15
15
|
|
16
16
|
class Mock
|
17
17
|
|
18
|
+
def release_address(address_id)
|
19
|
+
response = Excon::Response.new
|
20
|
+
response.status = 202
|
21
|
+
response.headers = {
|
22
|
+
"Content-Type" => "text/html; charset=UTF-8",
|
23
|
+
"Content-Length" => "0",
|
24
|
+
"Date" => Date.new
|
25
|
+
}
|
26
|
+
response.body = {}
|
27
|
+
response
|
28
|
+
end
|
29
|
+
|
30
|
+
end # mock
|
18
31
|
|
19
|
-
end
|
20
32
|
end
|
21
33
|
end
|
22
34
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def reset_server_state(server_id, status)
|
7
|
+
body = { 'os-resetState' => { 'state' => status } }
|
8
|
+
server_action(server_id, body, 202)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
|
15
|
+
def reset_server_state(server_id, status)
|
16
|
+
response = get_server_details(server_id)
|
17
|
+
response.body['server']['status'] = status.upcase
|
18
|
+
response
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Fog
|
2
|
+
module Identity
|
3
|
+
class OpenStack
|
4
|
+
|
5
|
+
class Real
|
6
|
+
def set_tenant(tenant)
|
7
|
+
@openstack_must_reauthenticate = true
|
8
|
+
@openstack_tenant = tenant.to_s
|
9
|
+
authenticate
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
def set_tenant(tenant)
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end # class OpenStack
|
20
|
+
end # module Identity
|
21
|
+
end # module Fog
|
data/lib/fog/openstack/volume.rb
CHANGED
@@ -142,6 +142,7 @@ module Fog
|
|
142
142
|
response = @connection.request(params.merge({
|
143
143
|
:headers => {
|
144
144
|
'Content-Type' => 'application/json',
|
145
|
+
'Accept' => 'application/json',
|
145
146
|
'X-Auth-Token' => @auth_token
|
146
147
|
}.merge!(params[:headers] || {}),
|
147
148
|
:host => @host,
|
@@ -174,7 +175,7 @@ module Fog
|
|
174
175
|
private
|
175
176
|
|
176
177
|
def authenticate
|
177
|
-
if
|
178
|
+
if !@openstack_management_url || @openstack_must_reauthenticate
|
178
179
|
options = {
|
179
180
|
:openstack_tenant => @openstack_tenant,
|
180
181
|
:openstack_api_key => @openstack_api_key,
|