summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-07-23 16:57:04 +0900
committerIsaku Yamahata <yamahata@valinux.co.jp>2011-07-23 16:57:04 +0900
commit24b6597035c4393383ed1bdc2a6e52830743a7ea (patch)
tree6184b71ed0921c5508a7725a266cbbe8a9bea2e4
parent405df88f00ce71621d3fda3ec52e5cf1217c8e05 (diff)
db/api: fix network_get_by_cidr()
User of the function is only 'nova-manage network delete'. It doesn't check deleted flag which must be checked. Otherwise some it might pick up deleted column depending on query result, and tries to delete already deleted columns and results in exception.
-rw-r--r--nova/db/sqlalchemy/api.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index ad51f5192..abfa6a3b7 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1681,7 +1681,9 @@ def network_get_by_bridge(context, bridge):
def network_get_by_cidr(context, cidr):
session = get_session()
result = session.query(models.Network).\
- filter_by(cidr=cidr).first()
+ filter_by(cidr=cidr).\
+ filter_by(deleted=False).\
+ first()
if not result:
raise exception.NetworkNotFoundForCidr(cidr=cidr)