Remove neutron host operations in sysinv conductor

Everytime sysinv-agent is started/restarted, it call sysinv-conductor
rpc subfunctions_update_by_ihost. sysinv-conductor tries to list/create
neutron host, but seems neutron host feature is removed(because the
python-neutronclient doesn't support these apis anymore, i.e.
list_hosts, create_hosts). As a result, subfunctions_update_by_ihost
raise exception.

This patch is to remove neutron host operations in
subfunctions_update_by_ihost.

Closes-bug: #1819400

Change-Id: Ia4f8871547460b7fa186e18966008efdc088b784
Signed-off-by: chengli3 <cheng1.li@intel.com>
This commit is contained in:
chengli3 2019-04-18 15:02:46 +08:00
parent 5070f6491b
commit d8ba7d68e9
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
#################