adding a host with az_aware fails

Bug #1880646 reported by Sam Morrison
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Blazar
Fix Released
High
Sam Morrison

Bug Description

When doing a host-create I get an error

2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server [-] Exception during message handling: TypeError: argument of type 'NoneType' is not iterable
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server Traceback (most recent call last):
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/rpc/server.py", line 166, in _process_incoming
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 265, in dispatch
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 194, in _do_dispatch
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args)
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server File "/opt/blazar/blazar/utils/service.py", line 77, in run_method
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server return method(**kwargs)
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server File "/opt/blazar/blazar/plugins/oshosts/host_plugin.py", line 353, in create_computehost
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server host_details = inventory.get_host_details(host_ref)
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server File "/opt/blazar/blazar/utils/openstack/nova.py", line 494, in get_host_details
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server if (host_name in zone.hosts
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server TypeError: argument of type 'NoneType' is not iterable
2020-05-26 15:59:47.408 3737 ERROR oslo_messaging.rpc.server

Looking into this fully I see a few things that are wrong.
It's assuming a zone has hosts when it is possible for an az to be empty for some reason.
It is also using hypervisor hostname to check if the host is in the AZ, it should be using the service host_name.

Pierre Riteau (priteau)
Changed in blazar:
importance: Undecided → High
assignee: nobody → Sam Morrison (sorrison)
milestone: none → victoria-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (master)

Reviewed: https://review.opendev.org/730706
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=532544efbf5fc3a2daf60af5d3c216b0b6a62c42
Submitter: Zuul
Branch: master

commit 532544efbf5fc3a2daf60af5d3c216b0b6a62c42
Author: Sam Morrison <email address hidden>
Date: Tue May 26 16:29:27 2020 +1000

    Fix up adding availability zone (AZ) to a host on creation

    1. Nova AZ returns hosts as service hosts as opposed to hypervisor
       hostnames
    2. Handle case where a Nova AZ has no hosts

    Change-Id: If6f6cf21170e95c58dd8a0a1b41b9b5f4797a627
    Closes-Bug: #1880646

Changed in blazar:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to blazar (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/738747

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to blazar (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/738748

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to blazar (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/738749

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (stable/ussuri)

Reviewed: https://review.opendev.org/738747
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=fd652cba5d49c046b4765b4616b8546726de98e3
Submitter: Zuul
Branch: stable/ussuri

commit fd652cba5d49c046b4765b4616b8546726de98e3
Author: Sam Morrison <email address hidden>
Date: Tue May 26 16:29:27 2020 +1000

    Fix up adding availability zone (AZ) to a host on creation

    1. Nova AZ returns hosts as service hosts as opposed to hypervisor
       hostnames
    2. Handle case where a Nova AZ has no hosts

    Change-Id: If6f6cf21170e95c58dd8a0a1b41b9b5f4797a627
    Closes-Bug: #1880646
    (cherry picked from commit 532544efbf5fc3a2daf60af5d3c216b0b6a62c42)

tags: added: in-stable-ussuri
tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (stable/train)

Reviewed: https://review.opendev.org/738748
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=d15c6ce078c0bfab5e471f60808fdd35120532ce
Submitter: Zuul
Branch: stable/train

commit d15c6ce078c0bfab5e471f60808fdd35120532ce
Author: Sam Morrison <email address hidden>
Date: Tue May 26 16:29:27 2020 +1000

    Fix up adding availability zone (AZ) to a host on creation

    1. Nova AZ returns hosts as service hosts as opposed to hypervisor
       hostnames
    2. Handle case where a Nova AZ has no hosts

    Change-Id: If6f6cf21170e95c58dd8a0a1b41b9b5f4797a627
    Closes-Bug: #1880646
    (cherry picked from commit 532544efbf5fc3a2daf60af5d3c216b0b6a62c42)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (stable/stein)

Reviewed: https://review.opendev.org/738749
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=6bbad1bc79eb2f9535e58f0c9ff19669eaac1373
Submitter: Zuul
Branch: stable/stein

commit 6bbad1bc79eb2f9535e58f0c9ff19669eaac1373
Author: Sam Morrison <email address hidden>
Date: Tue May 26 16:29:27 2020 +1000

    Fix up adding availability zone (AZ) to a host on creation

    1. Nova AZ returns hosts as service hosts as opposed to hypervisor
       hostnames
    2. Handle case where a Nova AZ has no hosts

    Change-Id: If6f6cf21170e95c58dd8a0a1b41b9b5f4797a627
    Closes-Bug: #1880646
    (cherry picked from commit 532544efbf5fc3a2daf60af5d3c216b0b6a62c42)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/blazar 4.0.1

This issue was fixed in the openstack/blazar 4.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/blazar 5.0.1

This issue was fixed in the openstack/blazar 5.0.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.