fog-openstack icon indicating copy to clipboard operation
fog-openstack copied to clipboard

Cannot connect to metering service, 406 Not Acceptable error

Open MiloCheung opened this issue 9 years ago • 0 comments
trafficstars

Hi All, I'm trying to connect metering service with the following coding. I am ok to list the volumes info by compute services, but it doesn't work for metering services. I am able to check the the stats info in horizon UI, so that I think the metering services should be fine. Anyone can help? thanks.

fog info:fog-openstack-0.1.11

Code

require 'fog/openstack'
settings =
{
 :openstack_auth_url=>"http://192.168.10.253:5000/v2.0/tokens",
 :openstack_username=>"username",
 :openstack_api_key=>"password",
 :connection_options=>{:ssl_verify_peer=>false},
 :openstack_tenant=>"tenant",
}
compute_conn = Fog::Compute::OpenStack.new(settings)
compute_conn.list_volumes #it's work
metering_conn = Fog::Metering::OpenStack.new(settings)

Error info [65] pry(main)> metering_conn = Fog::Metering::OpenStack.new(settings) Excon::Error::NotAcceptable: Expected([200, 204, 300]) <=> Actual(406 Not Acceptable) excon.error.response :body => "{"error_message": {"code": 406, "description": null, "title": "Not Acceptable"}}" :cookies => [ ] :headers => { "Content-Length" => "80" "Content-Type" => "application/json" "Date" => "Wed, 31 Aug 2016 03:14:56 GMT" "Server" => "WSGIServer/0.1 Python/2.7.6" } :host => "192.168.10.253" :local_address => "192.168.10.10" :local_port => 37668 :path => "/" :port => 8777 :reason_phrase => "Not Acceptable" :remote_ip => "192.168.10.253" :status => 406 :status_line => "HTTP/1.0 406 Not Acceptable\r\n" from /home/milo/.rvm/gems/ruby-2.1.2@test/gems/excon-0.52.0/lib/excon/middlewares/expects.rb:7:in `response_call'

Update: Just tested two version of fog-openstack(0.1.7, 0.1.8), I found that the version 0.1.7 is ok to list meter info, and 0.1.8 can't. The difference of these two version is , a new method call(set_api_path) in lib/fog/openstack/metering.rb:112. However, I tried to comment out this method call, then I will hit the 404 error not found error.

MiloCheung avatar Aug 31 '16 03:08 MiloCheung