• このエントリーをはてなブックマークに追加

【openstack】heatにstackを登録できない

  • このエントリーをはてなブックマークに追加

heat
zaco muraです。

openstack環境を構築するのに公式ドキュメントを使っています。ほとんどはドキュメント通りにやればよいのですが、heatをインストールするところで少しつまづきましたのでメモします。

環境

・centos7.1.1503
・openstack kilo

事象

stackの登録に失敗する。こんな感じ

[root@controller ~]# heat stack-create -f /root/test-stack.yml -P  "ImageID=cirros-0.3.4-x86_64;NetID=$NET_ID" testStack
ERROR: The template section is invalid: NetID

### デバッグモードで実行するとより詳細にエラーが出る
[root@controller ~]# heat -d stack-create -f /root/test-stack.yml -P  "ImageID=cirros-0.3.4-x86_64;NetID=$NET_ID" testStack
DEBUG (session) REQ: curl -g -i -X GET http://controller:35357/v3 -H "Accept: application/json" -H "User-Agent: python-keystoneclient"
INFO (connectionpool) Starting new HTTP connection (1): controller
DEBUG (connectionpool) "GET /v3 HTTP/1.1" 200 250
DEBUG (session) RESP: [200] content-length: 250 vary: X-Auth-Token keep-alive: timeout=5, max=100 server: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5 connection: Keep-Alive date: Tue, 20 Oct 2015 01:22:11 GMT content-type: application/json x-openstack-request-id: req-d65c361a-6762-455c-a90a-a393cf6696ca 
RESP BODY: {"version": {"status": "stable", "updated": "2015-03-30T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.4", "links": [{"href": "http://controller:35357/v3/", "rel": "self"}]}}

DEBUG (base) Making authentication request to http://controller:35357/v3/auth/tokens
DEBUG (connectionpool) "POST /v3/auth/tokens HTTP/1.1" 201 5326
DEBUG (session) REQ: curl -g -i -X POST http://controller:8004/v1/194986bd218b43cb93828a9b0c9d6a8a/stacks -H "X-Auth-Key: test123" -H "X-Auth-User: admin" -H "User-Agent: python-heatclient" -H "Content-Type: application/json" -H "X-Auth-Url: http://controller:35357/v3" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}ae3e2d9c0cba7fb3c283935952049d6d46a9ae8b" -d '{"files": {}, "disable_rollback": true, "parameters": {"ImageID": "cirros-0.3.4-x86_64", "NetID": "f06edb69-abbc-443e-930b-7400eb6703d0"}, "stack_name": "testStack", "environment": {}, "template": {"properties": null, "heat_template_version": "2014-10-16", "description": "IP address of the server in the private network", "parameters": null, "NetID": null, "outputs": null, "image": {"get_param": "ImageID"}, "value": {"get_attr": ["server", "first_address"]}, "ImageID": null, "private_ip": null, "flavor": "m1.tiny", "server": null, "type": "OS::Nova::Server", "networks": [{"network": {"get_param": "NetID"}}], "resources": null}}'
INFO (connectionpool) Starting new HTTP connection (1): controller
DEBUG (connectionpool) "POST /v1/194986bd218b43cb93828a9b0c9d6a8a/stacks HTTP/1.1" 400 269
DEBUG (session) RESP:
Traceback (most recent call last):
  File "/bin/heat", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/heatclient/shell.py", line 705, in main
    HeatShell().main(args)
  File "/usr/lib/python2.7/site-packages/heatclient/shell.py", line 655, in main
    args.func(client, args)
  File "/usr/lib/python2.7/site-packages/heatclient/v1/shell.py", line 126, in do_stack_create
    hc.stacks.create(**fields)
  File "/usr/lib/python2.7/site-packages/heatclient/v1/stacks.py", line 134, in create
    data=kwargs, headers=headers)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 265, in json_request
    resp = self._http_request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 363, in _http_request
    raise exc.from_response(resp)
heatclient.exc.HTTPBadRequest: ERROR: The template section is invalid: NetID

原因

ドキュメントから直接vimにコピペすることで、スペースやタブがうまくコピーされないことでした。

参考 : https://ask.openstack.org/en/question/63512/heat-stack-create-error-the-template-section-is-invalid-netid/

対処

ドキュメントを一回テキストファイルにコピーし、そこからvimに貼り付けることで解決しました。

[root@controller ~]# heat stack-create -f /root/test-stack.yml -P "ImageID=cirros-0.3.4-x86_64;NetID=$NET_ID" testStack
+--------------------------------------+------------+--------------------+----------------------+
| id                                   | stack_name | stack_status       | creation_time        |
+--------------------------------------+------------+--------------------+----------------------+
| 8d42badd-97df-44be-abe7-2750b99db71a | testStack  | CREATE_IN_PROGRESS | 2015-10-20T01:25:37Z |
+--------------------------------------+------------+--------------------+----------------------+
スポンサーリンク
Sponsords Link
  • このエントリーをはてなブックマークに追加

ZacoDesign

スポンサーリンク
Sponsords Link