OS::Nova::HostAggregate fails to parse in heat-engine when `hosts` is present

Solution In Progress - Updated -

Issue

$ more ag-env.yaml 
parameter_defaults:
  host_aggregate_name: test
  availability_zone_name: nova
  hosts: overcloud-computehci-0.idm.localhost.localdomain
  metadata: { "availability_zone": "nova" }
  • Sample template using OS::Nova::HostAggregate:
$ wget https://raw.githubusercontent.com/openstack/heat-templates/master/hot/nova/host_aggregate.yaml -o ag.yaml
$ more ag.yaml
heat_template_version: 2015-10-15

description: Sample Nova Host Aggregate template

parameters:
  host_aggregate_name:
    type: string
    description: Nova host aggregate name
  availability_zone_name:
    type: string
    description: Nova availability zone name
  hosts:
    type: comma_delimited_list
    description: Nova host name list
  metadata:
    type: json
    description: Arbitrary key/value metadata

resources:
  sample_host_aggregate:
    type: OS::Nova::HostAggregate
    properties:
      name: {get_param: host_aggregate_name}
      availability_zone: {get_param: availability_zone_name}
      hosts: {get_param: hosts}
      metadata: {get_param: metadata}

outputs:
  sample_host_aggregate_id:
    value: {get_resource: sample_host_aggregate}
    description: Sample nova host_aggregate
  • Creating the stack fails when setting hosts value:
$ openstack --debug stack create -t ./ag.yaml -e ./ag-env.yaml test

REQ: curl -g -i -X POST https://overcloud.idm.localhost.localdomain:13004/v1/36f5a6f9b5294b63806fea55f58734ff/stacks -H "User-Agent: python-heatclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "
X-Auth-Token: nope" -d '{"files": {"file:///home/stack/overcloud/ag-env.yaml": "{\"parameter_defaults\": {\"availability_zone_name\": \"nova\", \"host_aggregate_name\": 
\"test\", \"hosts\": \"overcloud-computehci-0.idm.localhost.localdomain\", \"metadata\": {\"availability_zone\": \"nova\"}}}"}, "disable_rollback": true, "parameters": {}, "stack_name": "test", "environment_files": ["file:///home/stack/overcloud/ag-env.yaml"], "environment": {"parameter_defaults": {"availability_zone_name": "nova", "host_aggregate_name": "test", "hosts": "overcloud-computehci-0.idm.localhost.localdomain", "metadata": {"avai
lability_zone": "nova"}}}, "template": {"outputs": {"sample_host_aggregate_id": {"description": "Sample nova host_aggregate", "value": {"get_resource": "sample_host_aggregate"}}}, "heat_template_version": "2015-
10-15", "description": "Sample Nova Host Aggregate template", "parameters": {"availability_zone_name": {"type": "string", "description": "Nova availability zone name"}, "host_aggregate_name": {"type": "string", 
"description": "Nova host aggregate name"}, "hosts": {"type": "comma_delimited_list", "description": "Nova host name list"}, "metadata": {"type": "json", "description": "Arbitrary key/value metadata"}}, "resourc
es": {"sample_host_aggregate": {"type": "OS::Nova::HostAggregate", "properties": {"availability_zone": {"get_param": "availability_zone_name"}, "hosts": {"get_param": "hosts"}, "name": {"get_param": "host_aggreg
ate_name"}, "metadata": {"get_param": "metadata"}}}}}}'
Starting new HTTPS connection (1): overcloud.idm.localhost.localdomain
https://overcloud.idm.localhost.localdomain:13004 "POST /v1/36f5a6f9b5294b63806fea55f58734ff/stacks HTTP/1.1" 400 344
RESP: [400] Date: Thu, 08 Aug 2019 03:00:42 GMT Server: Apache x-openstack-request-id: req-e3a946ec-e78b-4ec7-9142-4db42df43688 Content-Length: 344 Content-Type: application/json 
RESP BODY: {"explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400, "error": {"message": "Property error: : resources.sample_host_aggregat
e.properties.hosts[0]: : 'Client' object has no attribute 'hosts'", "traceback": null, "type": "StackValidationFailed"}, "title": "Bad Request"}

POST call to orchestration for https://overcloud.idm.localhost.localdomain:13004/v1/36f5a6f9b5294b63806fea55f58734ff/stacks used request id req-e3a946ec-e78b-4ec7-9142-4db42df43688
ERROR: Property error: : resources.sample_host_aggregate.properties.hosts[0]: : 'Client' object has no attribute 'hosts'


Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 400, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/heatclient/osc/v1/stack.py", line 183, in take_action
    stack = client.stacks.create(**fields)['stack']
  File "/usr/lib/python2.7/site-packages/heatclient/v1/stacks.py", line 171, in create
    data=kwargs, headers=headers)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 310, in post
    return self.request(url, 'POST', **kwargs)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 320, in request
    raise exc.from_response(resp)
HTTPBadRequest: ERROR: Property error: : resources.sample_host_aggregate.properties.hosts[0]: : 'Client' object has no attribute 'hosts'
clean_up CreateStack: ERROR: Property error: : resources.sample_host_aggregate.properties.hosts[0]: : 'Client' object has no attribute 'hosts'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 134, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 279, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 169, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 400, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/heatclient/osc/v1/stack.py", line 183, in take_action
    stack = client.stacks.create(**fields)['stack']
  File "/usr/lib/python2.7/site-packages/heatclient/v1/stacks.py", line 171, in create
    data=kwargs, headers=headers)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 310, in post
    return self.request(url, 'POST', **kwargs)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 320, in request
    raise exc.from_response(resp)
HTTPBadRequest: ERROR: Property error: : resources.sample_host_aggregate.properties.hosts[0]: : 'Client' object has no attribute 'hosts'

END return value: 1
  • If we deploy this template without defining hosts the stack deploys but the aggregate has no members. We can add members manually with the openstack aggregate host add still but this defeats the purpose of automating through heat.

Environment

  • Red Hat OpenStack Platform 13.0 (RHOSP)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In