Remove evacuate - this functionality is not working well, and should not be a part of Vitrage.

Change-Id: Icc2c40cc7994970b154e6529bce6ade66e4e70fa
Closes-Bug: #1622333
This commit is contained in:
Ifat Afek 2017-01-17 09:37:04 +00:00
parent b1a2827140
commit bc81adab72
2 changed files with 0 additions and 35 deletions

View File

@ -20,9 +20,4 @@ OPTS = [
'nova_notifier.NovaNotifier',
help='nova notifier class path',
required=True),
cfg.BoolOpt('enable_host_evacuate', default=False,
help='Evacuate a host that is marked as down'),
cfg.BoolOpt('on_shared_storage', default=False,
help='Indicates that all instance files are '
'on a shared storage'),
]

View File

@ -31,15 +31,11 @@ class NovaNotifier(NotifierBase):
def __init__(self, conf):
super(NovaNotifier, self).__init__(conf)
self.client = os_clients.nova_client(conf)
self.enable_evacuate = conf.nova.enable_host_evacuate
self.on_shared_storage = conf.nova.on_shared_storage
def process_event(self, data, event_type):
if data and data.get(VProps.TYPE) == NOVA_HOST_DATASOURCE:
if event_type == NotifierEventTypes.ACTIVATE_MARK_DOWN_EVENT:
self._mark_host_down(data.get(VProps.ID), True)
if self.enable_evacuate:
self._evacuate(data.get(VProps.ID))
elif event_type == NotifierEventTypes.DEACTIVATE_MARK_DOWN_EVENT:
self._mark_host_down(data.get(VProps.ID), False)
@ -52,29 +48,3 @@ class NovaNotifier(NotifierBase):
LOG.info('RESPONSE %s', str(response))
except Exception as e:
LOG.exception('Failed to services.force_down - %s', e)
def _evacuate(self, host_id):
try:
LOG.info('Going to evacuate all instances from host id: %s',
str(host_id))
hypervisors = self.client.hypervisors.search(host_id, servers=True)
except Exception as e:
LOG.exception('Failed to get hypervisors - %s', e)
return
for hyper in hypervisors:
if hasattr(hyper, 'servers'):
for server in hyper.servers:
self._evacuate_instance(server)
def _evacuate_instance(self, server):
try:
LOG.info('Calling Nova servers.evacuate - server: %s, '
'on_shared_storage: %s',
str(server), self.on_shared_storage)
response = self.client.servers.evacuate(
server=server['uuid'],
on_shared_storage=self.on_shared_storage)
LOG.info('RESPONSE %s', str(response))
except Exception as e:
LOG.exception('Failed to evacuate server - %s', e)