[Sanity] Exclude bmt* nodes from checking nova hypervisors consistency
The test test_nova_hosts_consistent failed on Ironic envs because
bmt* nodes are Ironic client nodes with ironic-* and nova-compute
services running. Due to nova-compute services up, the bmt* nodes
are expected to appear in openstack hosts and nova service list,
however they are not expected to by in hypervisors list.
So, need to skip bmt* nodes in this test.
Change-Id: I76ce24bba7f3fc74c009f6741aee09b6f246bc23
Related-prod: PROD-34170
diff --git a/test_set/cvp-sanity/tests/test_nova_services.py b/test_set/cvp-sanity/tests/test_nova_services.py
index a6fe959..14881a6 100644
--- a/test_set/cvp-sanity/tests/test_nova_services.py
+++ b/test_set/cvp-sanity/tests/test_nova_services.py
@@ -17,22 +17,35 @@
@pytest.mark.smoke
@pytest.mark.usefixtures('check_openstack')
def test_nova_hosts_consistent(local_salt_client):
+ # exclude bmt* nodes because they also have nova-compute running
+ # but they are not the hypervisors
+ ironic = local_salt_client.test_ping(tgt='ironic:client')
+ if ironic:
+ ironic_nodes = [i.split('.')[0] for i in ironic]
+ grep_exclude_ironic = "| egrep -v '{}'".format("|".join(ironic_nodes))
+ else:
+ grep_exclude_ironic = ""
+
all_cmp_services = local_salt_client.cmd_any(
tgt='keystone:server',
param='. /root/keystonercv3;'
- 'nova service-list | grep "nova-compute" | wc -l')
+ 'nova service-list | grep "nova-compute" '
+ '{} | wc -l'.format(grep_exclude_ironic))
enabled_cmp_services = local_salt_client.cmd_any(
tgt='keystone:server',
param='. /root/keystonercv3;'
- 'nova service-list | grep "nova-compute" | grep "enabled" | wc -l')
+ 'nova service-list | grep "nova-compute" | grep "enabled" '
+ '{} | wc -l'.format(grep_exclude_ironic))
hosts = local_salt_client.cmd_any(
tgt='keystone:server',
param='. /root/keystonercv3;'
- 'openstack host list | grep "compute" | wc -l')
+ 'openstack host list | grep "compute" '
+ '{} | wc -l'.format(grep_exclude_ironic))
hypervisors = local_salt_client.cmd_any(
tgt='keystone:server',
param='. /root/keystonercv3;'
- 'openstack hypervisor list | egrep -v "\-----|ID" | wc -l')
+ 'openstack hypervisor list | egrep -v "\-----|ID" '
+ '{} | wc -l'.format(grep_exclude_ironic))
assert all_cmp_services == hypervisors, (
"Number of nova-compute services ({}) does not match number of "