Add error instance status to vbmc reporing

Added `error` status to `vbmc list` and `vbmc start`
commands output. If the instance is failing to start, such
instance will be shown as being in `error` satte rather
than being `down`.

Change-Id: I3ad307f97442c6b30c3e60bd8186bfb30903c0b0
Story: 2006457
Task: 36378
This commit is contained in:
Ilya Etingof 2020-02-19 23:29:14 +01:00
parent 834d02e616
commit f79c9ee89a
2 changed files with 17 additions and 8 deletions

View File

@ -0,0 +1,5 @@
features:
- |
Added ``error`` status to ``vbmc list`` and ``vbmc start`` commands
output. If the instance is failing to start, such instance will be shown
as ``error`` rather than being ``down``.

View File

@ -27,6 +27,7 @@ LOG = log.get_logger()
# BMC status
RUNNING = 'running'
DOWN = 'down'
ERROR = 'error'
DEFAULT_SECTION = 'VirtualBMC'
@ -165,7 +166,7 @@ class VirtualBMCManager(object):
if lets_enable:
if not instance:
if not instance or not instance.is_alive():
instance = multiprocessing.Process(
name='vbmcd-managing-domain-%s' % domain_name,
@ -183,6 +184,13 @@ class VirtualBMCManager(object):
'%(domain)s', {'domain': domain_name}
)
if not instance.is_alive():
LOG.debug(
'Found dead vBMC instance for domain %(domain)s '
'(rc %(rc)s)', {'domain': domain_name,
'rc': instance.exitcode}
)
else:
if instance:
if instance.is_alive():
@ -192,13 +200,7 @@ class VirtualBMCManager(object):
'%(domain)s', {'domain': domain_name}
)
if instance and not instance.is_alive():
del self._running_domains[domain_name]
LOG.debug(
'Reaped vBMC instance for domain %(domain)s '
'(rc %(rc)s)', {'domain': domain_name,
'rc': instance.exitcode}
)
self._running_domains.pop(domain_name, None)
def _show(self, domain_name):
bmc_config = self._parse_config(domain_name)
@ -214,6 +216,8 @@ class VirtualBMCManager(object):
if instance and instance.is_alive():
show_options['status'] = RUNNING
elif instance and not instance.is_alive():
show_options['status'] = ERROR
else:
show_options['status'] = DOWN