[CPDEV-103936] Fix prepare_dns_etc_hosts for work with unavailable nodes #680
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When one or more nodes are unavailable,
add_node
,remove_node
procedures have to be run withprepare.dns.etc_hosts
orupdate.etc_hosts
task skipped (see PR).If after that you try to add another node,
add_node
fails with error likeFixes # (issue)
CPDEV-103936
Solution
New boolean parameter
globals.ignore_unavailable_nodes_for_etchosts_update
is added to cluster.yaml with default value False.system_prepare_dns_etc_hosts
is adjusted to work as previously ifglobals.ignore_unavailable_nodes_for_etchosts_update= false
and update /etc/hosts only at the available nodes if it's set to True.IN is updated with description of new variable.
How to apply
Test Cases
TestCase 1
step 1) Set
globals.ignore_unavailable_nodes_for_etchosts_update
totrue
in the cluster.yaml, disable one of the nodes in a cluster and try to add a new node withadd_node
procedure.ER: The new node is added successfully
step 2) With the node still disabled and
globals.ignore_unavailable_nodes_for_etchosts_update
set totrue
, try to add another new node withadd_node
procedure.ER: The new node is added successfully
TestCase 2
When a node is disabled in cluster and
globals.ignore_unavailable_nodes_for_etchosts_update
is set totrue
, remove another node withremove_node
procedure.ER: The node is removed successfully.
TestCase 3
Remove
globals.ignore_unavailable_nodes_for_etchosts_update
variable from cluster.yaml and try to add a node when there is at least one unavailable node.ER:
add_node
fails because not all the nodes are available.TestCase 4
Remove
globals.ignore_unavailable_nodes_for_etchosts_update
variable from cluster.yaml and try to add a node when all the nodes are available.ER:
add_node
finishes successfully.Checklist
Unit tests
Indicate new or changed unit tests and what they do, if any.