验证失败,是因为我的api_key写的不对???
size=30
OpenStack.volumes.create(size: size, name: 'test', description: 'test')
[fog][WARNING] OpenStack[:compute] is not recommended, use Compute[:openstack]
for portability
Excon::Errors::Unauthorized: Expected([200, 204]) <=> Actual(401 Unauthorized)
excon.error.response
:body => "{\"error\": {\"message\": \"The request you have made req
uires authentication.\", \"code\": 401, \"title\": \"Unauthorized\"}}"
:headers => {
"Content-Length" => "114"
"Content-Type" => "application/json"
"Date" => "Wed, 03 Dec 2014 12:32:29 GMT"
"Vary" => "X-Auth-Token"
"Www-Authenticate" => "Keystone uri=\"http://114.212.189.147:5000\""
"X-Distribution" => "Ubuntu"
}
:local_address => "192.168.100.2"
:local_port => 49313
:reason_phrase => "Unauthorized"
:remote_ip => "114.212.189.147"
:status => 401
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/excon-0.42.0/lib/excon/middlewa
res/expects.rb:10:in `response_call'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/excon-0.42.0/lib/excon/middlewa
res/response_parser.rb:8:in `response_call'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/excon-0.42.0/lib/excon/connecti
on.rb:365:in `response'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/excon-0.42.0/lib/excon/connecti
on.rb:235:in `request'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-core-1.25.0/lib/fog/core/co
nnection.rb:63:in `request'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/openstack/co
re.rb:202:in `retrieve_tokens_v2'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/openstack/co
re.rb:97:in `authenticate_v2'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/openstack/co
mpute.rb:395:in `authenticate'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/openstack/co
mpute.rb:320:in `initialize'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-core-1.25.0/lib/fog/core/se
rvice.rb:115:in `new'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-core-1.25.0/lib/fog/core/se
rvice.rb:115:in `new'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-core-1.25.0/lib/fog/compute
.rb:56:in `new'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/bin/openstac
k.rb:31:in `block in []'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/bin/openstac
k.rb:57:in `yield'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/bin/openstac
k.rb:57:in `default'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/bin/openstac
k.rb:57:in `[]'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/lib/fog/bin.rb:39:in
`volumes'
from (irb):2:in `<top (required)>'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/bin/fog:76:in `block
in <top (required)>'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/bin/fog:76:in `catch
'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/gems/fog-1.25.0/bin/fog:76:in `<top
(required)>'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/bin/fog:23:in `load'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/bin/fog:23:in `<main>'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:in `eva
l'
from /home/nju/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:in `<ma
in>'>>