Merge "Fix for bug 902175"

This commit is contained in:
Jenkins 2011-12-14 00:38:01 +00:00 committed by Gerrit Code Review
commit 8c53e3b726

View File

@ -160,9 +160,10 @@ def port_list(net_id):
all()
def port_get(port_id, net_id):
def port_get(port_id, net_id, session=None):
# confirm network exists
network_get(net_id)
if not session:
session = get_session()
try:
return session.query(models.Port).\
@ -223,9 +224,9 @@ def port_unset_attachment(port_id, net_id):
network_get(net_id)
session = get_session()
port = port_get(port_id, net_id)
port = port_get(port_id, net_id, session)
port.interface_id = None
session.merge(port)
session.add(port)
session.flush()