blob: f223d3eac1cb9a0712319e0a55d70ec689fa620c [file] [log] [blame]
Ekaterina Chernovae32e3f92019-11-12 14:56:03 +03001from builtins import str
Oleksii Zhurbae592ed12018-06-21 18:01:09 -05002import pytest
Hanna Arhipova56eab942019-05-06 20:14:18 +03003import logging
Oleksii Zhurbae592ed12018-06-21 18:01:09 -05004
5
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -05006@pytest.mark.sl_dup
7#CinderServiceDown, CinderServicesDownMinor
8@pytest.mark.full
Hanna Arhipovaa14488d2019-04-30 15:08:33 +03009def test_cinder_services_are_up(local_salt_client, check_cinder_backends):
Hanna Arhipova835b0cb2019-04-10 17:10:20 +030010 """
11 # Make sure that cinder backend exists with next command: `salt -C "I@cinder:controller" pillar.get cinder:controller:backend`
12 # Check that all services has 'Up' status in output of `cinder service-list` on keystone:server nodes
Hanna Arhipova835b0cb2019-04-10 17:10:20 +030013 """
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050014 service_down = local_salt_client.cmd_any(
15 tgt='keystone:server',
16 param='. /root/keystonercv3; cinder service-list | grep "down\|disabled"')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020017 assert service_down == '', (
18 "Some Cinder services are in wrong state:\n{}".format(service_down))
19
Hanna Arhipovaa14488d2019-04-30 15:08:33 +030020
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -050021@pytest.mark.full
Hanna Arhipovaa14488d2019-04-30 15:08:33 +030022def test_cinder_services_has_all_backends(local_salt_client, check_cinder_backends):
23 """
24 # Make sure that cinder backend exists with next command: `salt -C "I@cinder:controller" pillar.get cinder:controller:backend`
25 # Check that quantity of backend in cinder:controller:backend pillar is similar to list of volumes in cinder service-list
26 """
27 backends_cinder = local_salt_client.pillar_get(
28 tgt='cinder:controller',
29 param='cinder:controller:backend'
30 )
31 cinder_volume = local_salt_client.cmd_any(
32 tgt='keystone:server',
33 param='. /root/keystonercv3; cinder service-list | grep "volume" |grep -c -v -e "lvm"')
Ekaterina Chernovae32e3f92019-11-12 14:56:03 +030034 backends_num = len(list(backends_cinder.keys()))
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020035 assert cinder_volume == str(backends_num), (
36 'Number of cinder-volume services ({0}) does not match number of '
37 'volume backends ({1}).'.format(cinder_volume, str(backends_num))
38 )