BigSwitch plugin - add portbinding info in requests to controller
Include portbinding info in requests to controller so it receives information about the compute node like the VIF type and the host ID. Also includes better debug output on back-end failures. Fixes: bug #1216061 Change-Id: Ib85c8a088ee9fb94baaf8f28849b318b32d9d672
This commit is contained in:
parent
1c2e111a0b
commit
69dd72931f
@ -295,10 +295,11 @@ class ServerPool(object):
|
||||
return ret
|
||||
else:
|
||||
LOG.error(_('ServerProxy: %(action)s failure for servers: '
|
||||
'%(server)r'),
|
||||
'%(server)r Response: %(response)s'),
|
||||
{'action': action,
|
||||
'server': (active_server.server,
|
||||
active_server.port)})
|
||||
active_server.port),
|
||||
'response': ret[3]})
|
||||
active_server.failed = True
|
||||
|
||||
# All servers failed, reset server list and try again next time
|
||||
@ -565,6 +566,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
and 'id' in new_port):
|
||||
porttracker_db.put_port_hostid(context, new_port['id'],
|
||||
port['port'][portbindings.HOST_ID])
|
||||
new_port = self._extend_port_dict_binding(context, new_port)
|
||||
net = super(NeutronRestProxyV2,
|
||||
self).get_network(context, new_port["network_id"])
|
||||
|
||||
@ -660,6 +662,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
and 'id' in new_port):
|
||||
porttracker_db.put_port_hostid(context, new_port['id'],
|
||||
port['port'][portbindings.HOST_ID])
|
||||
new_port = self._extend_port_dict_binding(context, new_port)
|
||||
# update on networl ctrl
|
||||
try:
|
||||
resource = PORTS_PATH % (orig_port["tenant_id"],
|
||||
@ -690,7 +693,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
raise
|
||||
|
||||
# return new_port
|
||||
return self._extend_port_dict_binding(context, new_port)
|
||||
return new_port
|
||||
|
||||
def delete_port(self, context, port_id, l3_port_check=True):
|
||||
"""Delete a port.
|
||||
|
@ -65,16 +65,34 @@ class HTTPResponseMock():
|
||||
return "{'status': '200 OK'}"
|
||||
|
||||
|
||||
class HTTPResponseMock500():
|
||||
status = 500
|
||||
reason = 'Internal Server Error'
|
||||
|
||||
def __init__(self, sock, debuglevel=0, strict=0, method=None,
|
||||
buffering=False, errmsg='500 Internal Server Error'):
|
||||
self.errmsg = errmsg
|
||||
|
||||
def read(self):
|
||||
return "{'status': '%s'}" % self.errmsg
|
||||
|
||||
|
||||
class HTTPConnectionMock():
|
||||
|
||||
def __init__(self, server, port, timeout):
|
||||
pass
|
||||
self.response = None
|
||||
|
||||
def request(self, action, uri, body, headers):
|
||||
self.response = HTTPResponseMock(None)
|
||||
# Port creations/updates must contain binding information
|
||||
if ('port' in uri and 'attachment' not in uri
|
||||
and 'binding' not in body and action in ('POST', 'PUT')):
|
||||
errmsg = "Port binding info missing in port request '%s'" % body
|
||||
self.response = HTTPResponseMock500(None, errmsg=errmsg)
|
||||
return
|
||||
|
||||
def getresponse(self):
|
||||
return HTTPResponseMock(None)
|
||||
return self.response
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user