lib/fog/openstack/volume.rb in fog-maestrodev-1.8.0.20130114204828 vs lib/fog/openstack/volume.rb in fog-maestrodev-1.14.0.20130806165225

- old
+ new

@@ -6,11 +6,12 @@ requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_api_key, :openstack_username, - :current_user, :current_tenant + :current_user, :current_tenant, + :openstack_endpoint_type model_path 'fog/openstack/models/volume' model :volume collection :volumes @@ -26,19 +27,28 @@ request :create_volume_snapshot request :list_snapshots request :get_snapshot_details request :delete_snapshot + + request :update_quota + request :get_quota + request :get_quota_defaults request :set_tenant class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :users => {}, - :tenants => {} + :tenants => {}, + :quota => { + 'gigabytes' => 1000, + 'volumes' => 10, + 'snapshots' => 10 + } } end end def self.reset @@ -112,10 +122,11 @@ @openstack_management_url = options[:openstack_management_url] @openstack_must_reauthenticate = false @openstack_service_type = options[:openstack_service_type] || ['volume'] @openstack_service_name = options[:openstack_service_name] + @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' @connection_options = options[:connection_options] || {} @current_user = options[:current_user] @current_tenant = options[:current_tenant] @@ -146,12 +157,10 @@ 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :host => @host, :path => "#{@path}/#{params[:path]}"#, - # Causes errors for some requests like tenants?limit=1 - # :query => ('ignore_awful_caching' << Time.now.to_i.to_s) })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate @@ -183,10 +192,10 @@ :openstack_username => @openstack_username, :openstack_auth_uri => @openstack_auth_uri, :openstack_auth_token => @openstack_auth_token, :openstack_service_type => @openstack_service_type, :openstack_service_name => @openstack_service_name, - :openstack_endpoint_type => 'adminURL' + :openstack_endpoint_type => @openstack_endpoint_type } credentials = Fog::OpenStack.authenticate_v2(options, @connection_options) @current_user = credentials[:user]