nova/nova/virt/ironic
melanie witt 019e3da75b Lowercase ironic driver hash ring and ignore case in cache
Recently we had a customer case where attempts to add new ironic nodes
to an existing undercloud resulted in half of the nodes failing to be
detected and added to nova. Ironic API returned all of the newly added
nodes when called by the driver, but half of the nodes were not
returned to the compute manager by the driver.

There was only one nova-compute service managing all of the ironic
nodes of the all-in-one typical undercloud deployment.

After days of investigation and examination of a database dump from the
customer, we noticed that at some point the customer had changed the
hostname of the machine from something containing uppercase letters to
the same name but all lowercase. The nova-compute service record had
the mixed case name and the CONF.host (socket.gethostname()) had the
lowercase name.

The hash ring logic adds all of the nova-compute service hostnames plus
CONF.host to hash ring, then the ironic driver reports only the nodes
it owns by retrieving a service hostname from the ring based on a hash
of each ironic node UUID.

Because of the machine hostname change, the hash ring contained, for
example: {'MachineHostName', 'machinehostname'} when it should have
contained only one hostname. And because the hash ring contained two
hostnames, the driver was able to retrieve only half of the nodes as
nodes that it owned. So half of the new nodes were excluded and not
added as new compute nodes.

This adds lowercasing of hosts that are added to the hash ring and
ignores case when comparing the CONF.host to the hash ring members
to avoid unnecessary pain and confusion for users that make hostname
changes that are otherwise functionally harmless.

This also adds logging of the set of hash ring members at level DEBUG
to help enable easier debugging of hash ring related situations.

Closes-Bug: #1866380

 Conflicts:
	nova/virt/ironic/driver.py

NOTE(melwitt): Conflict is because change
I1b184ff37948dc403fe38874613cd4d870c644fd is not in Rocky.

Change-Id: I617fd59de327de05a198f12b75a381f21945afb0
(cherry picked from commit 7145100ee4)
(cherry picked from commit 588b0484bf)
(cherry picked from commit 8f8667a8dd)
2020-04-24 22:50:32 +00:00
..
__init__.py Import Ironic Driver & supporting files - part 1 2014-09-05 19:00:12 -04:00
client_wrapper.py Pass on region when we don't have a valid ironic endpoint 2019-04-30 17:48:50 -05:00
driver.py Lowercase ironic driver hash ring and ignore case in cache 2020-04-24 22:50:32 +00:00
ironic_states.py virt/ironic: Implement rescue and unrescue 2018-07-13 01:56:13 +00:00
patcher.py Pushing image traits to ironic node 2018-05-18 18:05:25 -07:00