Merge "Remove neutron host operations in sysinv conductor"

This commit is contained in:
Zuul 2019-04-18 17:26:05 +00:00 committed by Gerrit Code Review
commit 22a8d6ee36
2 changed files with 0 additions and 69 deletions

View File

@ -4409,34 +4409,6 @@ class ConductorManager(service.PeriodicService):
:returns: pass or fail
"""
ihost_uuid.strip()
# Create the host entry in neutron to allow for data interfaces to
# be configured on a combined node
if (constants.CONTROLLER in subfunctions and
constants.WORKER in subfunctions):
try:
ihost = self.dbapi.ihost_get(ihost_uuid)
except exception.ServerNotFound:
LOG.exception("Invalid ihost_uuid %s" % ihost_uuid)
return
try:
neutron_host_id = \
self._openstack.get_neutron_host_id_by_name(
context, ihost['hostname'])
if not neutron_host_id:
self._openstack.create_neutron_host(context,
ihost_uuid,
ihost['hostname'])
elif neutron_host_id != ihost_uuid:
self._openstack.delete_neutron_host(context,
neutron_host_id)
self._openstack.create_neutron_host(context,
ihost_uuid,
ihost['hostname'])
except Exception: # TODO: DPENNEY: Needs better exception
LOG.exception("Failed in neutron stuff")
ihost_val = {'subfunctions': subfunctions}
self.dbapi.ihost_update(ihost_uuid, ihost_val)

View File

@ -242,47 +242,6 @@ class OpenStackOperator(object):
client.host_unbind_interface(host_uuid, body=body)
return True
def get_neutron_host_id_by_name(self, context, name):
"""
Get a neutron host
"""
client = self._get_neutronclient()
hosts = client.list_hosts()
if not hosts:
return ""
for host in hosts['hosts']:
if host['name'] == name:
return host['id']
return ""
def create_neutron_host(self, context, host_uuid, name,
availability='down'):
"""
Send a request to neutron to create a host
"""
client = self._get_neutronclient()
body = {'host': {'id': host_uuid,
'name': name,
'availability': availability
}}
client.create_host(body=body)
return True
def delete_neutron_host(self, context, host_uuid):
"""
Delete a neutron host
"""
client = self._get_neutronclient()
client.delete_host(host_uuid)
return True
#################
# NOVA
#################