Merge "Remove unused DB API and Pod object API"
This commit is contained in:
@ -459,14 +459,6 @@ class Connection(object):
|
||||
:returns: A pod.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_pods_by_bay_uuid(self, bay_uuid):
|
||||
"""List all the pods for a given bay.
|
||||
|
||||
:param bay_uuid: The uuid of a bay.
|
||||
:returns: A list of pods.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def destroy_pod(self, pod_id):
|
||||
"""Destroy a pod and all associated interfaces.
|
||||
|
@ -682,13 +682,6 @@ class Connection(api.Connection):
|
||||
except NoResultFound:
|
||||
raise exception.PodNotFound(pod=pod_name)
|
||||
|
||||
def get_pods_by_bay_uuid(self, bay_uuid):
|
||||
query = model_query(models.Pod).filter_by(bay_uuid=bay_uuid)
|
||||
try:
|
||||
return query.all()
|
||||
except NoResultFound:
|
||||
raise exception.BayNotFound(bay=bay_uuid)
|
||||
|
||||
def destroy_pod(self, pod_id):
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
|
@ -20,7 +20,8 @@ from magnum.objects import base
|
||||
class Pod(base.MagnumPersistentObject, base.MagnumObject,
|
||||
base.MagnumObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Remove unused Pod object API 'list_by_bay_uuid'
|
||||
VERSION = '1.1'
|
||||
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
@ -94,17 +95,6 @@ class Pod(base.MagnumPersistentObject, base.MagnumObject,
|
||||
pod = Pod._from_db_object(cls(context), db_pod)
|
||||
return pod
|
||||
|
||||
@base.remotable_classmethod
|
||||
def list_by_bay_uuid(cls, context, bay_uuid):
|
||||
"""Return a list of :class:`Pod` objects associated with a given bay.
|
||||
|
||||
:param bay_uuid: the uuid of a bay.
|
||||
:param context: Security context
|
||||
:returns: a list of class:`Pod` object.
|
||||
"""
|
||||
db_pods = cls.dbapi.get_pods_by_bay_uuid(bay_uuid)
|
||||
return Pod._from_db_object_list(db_pods, cls, context)
|
||||
|
||||
@base.remotable_classmethod
|
||||
def list(cls, context, limit=None, marker=None,
|
||||
sort_key=None, sort_dir=None):
|
||||
|
@ -148,14 +148,6 @@ class DbPodTestCase(base.DbTestCase):
|
||||
'bay_uuid': magnum_utils.generate_uuid()})
|
||||
self.assertEqual(0, len(res))
|
||||
|
||||
def test_get_pods_by_bay_uuid(self):
|
||||
res = self.dbapi.get_pods_by_bay_uuid(self.bay.uuid)
|
||||
self.assertEqual(self.pod.id, res[0].id)
|
||||
|
||||
def test_get_pods_by_bay_uuid_that_does_not_exist(self):
|
||||
res = self.dbapi.get_pods_by_bay_uuid(magnum_utils.generate_uuid())
|
||||
self.assertEqual([], res)
|
||||
|
||||
def test_destroy_pod(self):
|
||||
self.dbapi.destroy_pod(self.pod.id)
|
||||
self.assertRaises(exception.PodNotFound,
|
||||
|
@ -431,7 +431,7 @@ object_data = {
|
||||
'Container': '1.0-e12affbba5f8a748882a3ae98aced282',
|
||||
'MyObj': '1.0-b43567e512438205e32f4e95ca616697',
|
||||
'Node': '1.0-30943e6e3387a2fae7490b57c4239a17',
|
||||
'Pod': '1.0-69b579203c6d726be7878c606626e438',
|
||||
'Pod': '1.1-7a31c372f163742845c10a008f47cc15',
|
||||
'ReplicationController': '1.0-782b7deb9307b2807101541b7e58b8a2',
|
||||
'Service': '1.0-d4b8c0f3a234aec35d273196e18f7ed1',
|
||||
'X509KeyPair': '1.0-fd008eba0fbc390e0e5da247bba4eedd',
|
||||
|
Reference in New Issue
Block a user