From: Dan Wendlandt Date: Tue, 2 Aug 2011 17:14:25 +0000 (-0700) Subject: fix broken flush in db.network_destroy, pep8 fixes X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=32b5806ddf86b22f4d02cd8bf82753fedc2dd1c0;p=openstack-build%2Fneutron-build.git fix broken flush in db.network_destroy, pep8 fixes --- diff --git a/quantum/api/faults.py b/quantum/api/faults.py index 52b36109d..670ef9f89 100644 --- a/quantum/api/faults.py +++ b/quantum/api/faults.py @@ -91,6 +91,7 @@ class NetworkInUse(webob.exc.HTTPClientError): title = 'Network in Use' explanation = ('Unable to remove the network: attachments still plugged.') + class NetworkNameExists(webob.exc.HTTPClientError): """ subclass of :class:`~HTTPClientError` diff --git a/quantum/common/exceptions.py b/quantum/common/exceptions.py index b9705fb75..23dc700a4 100644 --- a/quantum/common/exceptions.py +++ b/quantum/common/exceptions.py @@ -107,6 +107,7 @@ class AlreadyAttached(QuantumException): "%(port_id)s for network %(net_id)s. The attachment is " \ "already plugged into port %(att_port_id)s") + class NetworkNameExists(QuantumException): message = _("Unable to set network name to %(net_name). " \ "Network with id %(net_id) already has this name for " \ diff --git a/quantum/db/api.py b/quantum/db/api.py index 5711a47dd..436df8415 100644 --- a/quantum/db/api.py +++ b/quantum/db/api.py @@ -89,6 +89,7 @@ def _check_duplicate_net_name(tenant_id, net_name): # that net-names are unique within a tenant pass + def network_create(tenant_id, name): session = get_session() @@ -126,6 +127,7 @@ def network_rename(net_id, tenant_id, new_name): session.flush() return net + def network_destroy(net_id): session = get_session() try: @@ -225,7 +227,7 @@ def port_unset_attachment(port_id, net_id): port = port_get(port_id, net_id) port.interface_id = None session.merge(port) - session.flush + session.flush() def port_destroy(port_id, net_id):