Improvement for services state check

Print service-name, host and reason for
services in Down state.

Change-Id: Iaea58fe237557c000b2b67ec74fccb44ad04e8dc
Closes-Bug: 1666215
This commit is contained in:
Dmitry Belyaninov 2017-02-21 14:00:00 +00:00
parent 31a1836d1f
commit a9df5d6208
1 changed files with 6 additions and 5 deletions

View File

@ -61,9 +61,12 @@ class SanityInfrastructureTest(nmanager.SanityChecksTest):
states = {}
for controller in self.controller_names:
svc = self._list_services(self.compute_client, host=controller)
down = [True for service in svc if service.state == downstate]
if any(down):
states[controller] = True
for sv in svc:
if sv.state == downstate:
LOG.debug("Service {0} is in Down state "
"on {1}. Reason: {2}".format(
sv.binary, sv.host, sv.disabled_reason))
states[controller] = True
return states
if not self.controllers:
@ -75,7 +78,6 @@ class SanityInfrastructureTest(nmanager.SanityChecksTest):
"'nova service-list' command execution",
)
LOG.debug(output)
try:
self.verify_response_true(
len(output) == 0,
@ -86,7 +88,6 @@ class SanityInfrastructureTest(nmanager.SanityChecksTest):
time.sleep(120)
# Re-collect data silently
output = get_controllers_down_states()
LOG.debug(output)
self.verify_response_true(
len(output) == 0,
'Step 2 failed: Some nova services have not been started.')