Move exception definitions out of db api

The two exceptions, NoMoreNetworks and NoMoreTargets, are defined
in nova/db/api. While NoMoreTargets is unused and can be removed,
NoMoreNetworks are still used and should be moved to exception.py
where all other exceptions live.

This came up during review of https://review.openstack.org/#/c/42980/
where compute manager would need to import nova.db to make use of
NoMoreNetworks.

Change-Id: I57f0a081d2fea35394421932ae7d2a3e67540a31
This commit is contained in:
Hans Lindgren
2013-10-11 13:27:06 +02:00
parent 0db710d860
commit 99e79772f2
4 changed files with 6 additions and 15 deletions

View File

@@ -23,7 +23,6 @@ from nova.cloudpipe import pipelib
from nova import compute
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import db
from nova import exception
from nova import network
from nova.openstack.common import fileutils
@@ -146,7 +145,7 @@ class CloudpipeController(object):
try:
result = self.cloudpipe.launch_vpn_instance(context)
instance = result[0][0]
except db.NoMoreNetworks:
except exception.NoMoreNetworks:
msg = _("Unable to claim IP for VPN instances, ensure it "
"isn't running, and try again in a few minutes")
raise exception.HTTPBadRequest(explanation=msg)