Fog和Openstack无法按名称指定网络

时间:2014-07-01 16:36:46

标签: chef openstack fog

我正在尝试一个名为Chef-Metal的厨师新功能,它使用Fog作为连接Openstack的驱动程序。我在获取正确的语法以识别我想要的名称而不是:net_id的网络时遇到了很多麻烦。这是我到目前为止一直在玩的东西:

:nics => [
  {
    :network => 'net-shared-vlan-25'                     # Doesn't Work
    # :name => 'net-shared-vlan-25'                      # Original Test (didn't work)
    # :net_id => '84685c12-ce9b-4056-8dcb-bfa2283e97bf'  # Works! (but need name)
  }
]

我不断得到(清理)的错误是:

Expected([200, 202]) <=> Actual(500 InternalServerError)
response => #<Excon::Response:0x0000000421c830
@data = {
  :body => "{\"computeFault\": {\"message\": \"The server has either erred or is incapable of performing the requested operation.\", \"code\": 500}}",
  :headers => {"Content-Length"=>"128", "Content-Type"=>"application/json; charset=UTF-8", "X-Compute-Request-Id"=>"req-eb48b850-0449-4a02-ae96-f6374b047b37", "Date"=>"Tue, 01 Jul 2014 16:08:55 GMT"},
  :status => 500,
  :remote_ip => "10.129.10.250",
  :local_port => 54683,
  :local_address => "10.129.17.41"},
@body = "{\"computeFault\": {\"message\": \"The server has either erred or is incapable of performing the requested operation.\", \"code\": 500}}",
@headers = {"Content-Length"=>"128", "Content-Type"=>"application/json; charset=UTF-8", "X-Compute-Request-Id"=>"req-eb48b850-0449-4a02-ae96-f6374b047b37", "Date"=>"Tue, 01 Jul 2014 16:08:55 GMT"},
@status = 500,
@remote_ip = "10.129.10.250",
@local_port = 54683,
@local_address = "10.129.17.41">

如果有人知道使用Fog在Openstack中按名称而不是ID识别网络所需的正确语法,那么您的帮助将不胜感激。感谢。

1 个答案:

答案 0 :(得分:0)

不幸的是,Chef Metal,更确切地说,Fog gem,只允许您通过 id 指定网络。可以找到Fog中的相关代码here

data['server']['networks'] = options[:networks] || [
  { :uuid => '00000000-0000-0000-0000-000000000000' },
  { :uuid => '11111111-1111-1111-1111-111111111111' }
]

我明白这有点烦人。

但这是开源的!您始终可以为Fog gem编写拉取请求,以从名称中查找网络的ID。好消息是,如果Fog支持它,那么Chef Metal将会这样做!