Ekaterina Chernova | e32e3f9 | 2019-11-12 14:56:03 +0300 | [diff] [blame] | 1 | from builtins import str |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 2 | import pytest |
Hanna Arhipova | 56eab94 | 2019-05-06 20:14:18 +0300 | [diff] [blame] | 3 | import logging |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 4 | |
| 5 | |
Oleksii Zhurba | 5b15b9b | 2019-05-09 18:53:40 -0500 | [diff] [blame] | 6 | @pytest.mark.sl_dup |
| 7 | #CinderServiceDown, CinderServicesDownMinor |
| 8 | @pytest.mark.full |
Hanna Arhipova | a14488d | 2019-04-30 15:08:33 +0300 | [diff] [blame] | 9 | def test_cinder_services_are_up(local_salt_client, check_cinder_backends): |
Hanna Arhipova | 835b0cb | 2019-04-10 17:10:20 +0300 | [diff] [blame] | 10 | """ |
| 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 Arhipova | 835b0cb | 2019-04-10 17:10:20 +0300 | [diff] [blame] | 13 | """ |
Oleksii Zhurba | 4bfd2ee | 2019-04-10 21:56:58 -0500 | [diff] [blame] | 14 | service_down = local_salt_client.cmd_any( |
| 15 | tgt='keystone:server', |
| 16 | param='. /root/keystonercv3; cinder service-list | grep "down\|disabled"') |
Dmitriy Kruglov | a34a304 | 2019-08-20 11:45:35 +0200 | [diff] [blame] | 17 | assert service_down == '', ( |
| 18 | "Some Cinder services are in wrong state:\n{}".format(service_down)) |
| 19 | |
Hanna Arhipova | a14488d | 2019-04-30 15:08:33 +0300 | [diff] [blame] | 20 | |
Oleksii Zhurba | 5b15b9b | 2019-05-09 18:53:40 -0500 | [diff] [blame] | 21 | @pytest.mark.full |
Hanna Arhipova | a14488d | 2019-04-30 15:08:33 +0300 | [diff] [blame] | 22 | def 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 Chernova | e32e3f9 | 2019-11-12 14:56:03 +0300 | [diff] [blame] | 34 | backends_num = len(list(backends_cinder.keys())) |
Dmitriy Kruglov | a34a304 | 2019-08-20 11:45:35 +0200 | [diff] [blame] | 35 | 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 | ) |