374fd2791fcd76653d517ee354bb33a164b86c9a
The get_compute_node_by_hostname method is given a compute service hostname and then does two queries to find the matching hypervisor (compute node) with details: 1. List hypervisors with details and find the one that matches the given compute service hostname. 2. Using that node, search for hypervisors with the matching hypervisor_hostname. There are two issues here: 1. The first query is inefficient in that it has to list all hypervisors in the deployment to try and match the one with the compute service hostname client side. 2. The second query is a fuzzy match on the server side [1] so even though we have matched on the node we want, get_compute_node_by_name can still return more than one hypervisor which will result in the helper method raising ComputeNodeNotFound. Consider having compute hosts with names compute1, compute10, compute11, compute100, and so on. The fuzzy match on compute1 would return all of those hypervisors. For non-ironic nodes in nova, the compute service host and hypervisor should be 1:1, meaning the hypervisor.service['host'] should be the same as hypervisor.hypervisor_hostname. Knowing this, we can simplify the code to search just on the given compute service hostname and if we get more than one result, it is because of the fuzzy match and we can then do our client-side filtering on the compute service hostname. [1] https://github.com/openstack/nova/blob/d4f58f5eb/nova/db/sqlalchemy/api.py#L676 Change-Id: I84f387982f665d7cc11bffe8ec390cc7e7ed5278
========================
Team and repository tags
========================
.. image:: https://governance.openstack.org/tc/badges/watcher.svg
:target: https://governance.openstack.org/tc/reference/tags/index.html
.. Change things from this point on
..
Except where otherwise noted, this document is licensed under Creative
Commons Attribution 3.0 License. You can view the license at:
https://creativecommons.org/licenses/by/3.0/
=======
Watcher
=======
OpenStack Watcher provides a flexible and scalable resource optimization
service for multi-tenant OpenStack-based clouds.
Watcher provides a robust framework to realize a wide range of cloud
optimization goals, including the reduction of data center
operating costs, increased system performance via intelligent virtual machine
migration, increased energy efficiency and more!
* Free software: Apache license
* Wiki: https://wiki.openstack.org/wiki/Watcher
* Source: https://opendev.org/openstack/watcher
* Bugs: https://bugs.launchpad.net/watcher
* Documentation: https://docs.openstack.org/watcher/latest/
* Release notes: https://docs.openstack.org/releasenotes/watcher/
Description
Languages
Python
99.7%
Shell
0.3%