from oslo.config import cfg
-from cinder import exception
from cinder.openstack.common.db import api as db_api
IMPL = db_api.DBAPI(backend_mapping=_BACKEND_MAPPING)
-class NoMoreTargets(exception.CinderException):
- """No more available targets."""
- pass
-
-
###################
from sqlalchemy.sql import func
from cinder.common import sqlalchemyutils
-from cinder import db
from cinder.db.sqlalchemy import models
from cinder import exception
from cinder.openstack.common.db import exception as db_exc
"""
def wrapper(context, volume_id, *args, **kwargs):
- db.volume_get(context, volume_id)
+ volume_get(context, volume_id)
return f(context, volume_id, *args, **kwargs)
wrapper.__name__ = f.__name__
return wrapper
"""
def wrapper(context, snapshot_id, *args, **kwargs):
- db.api.snapshot_get(context, snapshot_id)
+ snapshot_get(context, snapshot_id)
return f(context, snapshot_id, *args, **kwargs)
wrapper.__name__ = f.__name__
return wrapper
# NOTE(vish): if with_lockmode isn't supported, as in sqlite,
# then this has concurrency issues
if not iscsi_target_ref:
- raise db.NoMoreTargets()
+ raise exception.NoMoreTargets()
iscsi_target_ref.volume_id = volume_id
session.add(iscsi_target_ref)
message = _("No valid host was found. %(reason)s")
+class NoMoreTargets(CinderException):
+ """No more available targets."""
+ pass
+
+
class WillNotSchedule(CinderException):
message = _("Host %(host)s is not up or doesn't exist.")
self.assertEqual(volume.host, 'host1')
def test_volume_allocate_iscsi_target_no_more_targets(self):
- self.assertRaises(db.NoMoreTargets,
+ self.assertRaises(exception.NoMoreTargets,
db.volume_allocate_iscsi_target,
self.ctxt, 42, 'host1')