Merge "Add missing key attribute to AggregateList.get_by_host()"
This commit is contained in:
@@ -145,6 +145,10 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject):
|
|||||||
|
|
||||||
|
|
||||||
class AggregateList(base.ObjectListBase, base.NovaObject):
|
class AggregateList(base.ObjectListBase, base.NovaObject):
|
||||||
|
# Version 1.0: Initial version
|
||||||
|
# Version 1.1: Added key argument to get_by_host()
|
||||||
|
VERSION = '1.1'
|
||||||
|
|
||||||
@base.remotable_classmethod
|
@base.remotable_classmethod
|
||||||
def get_all(cls, context):
|
def get_all(cls, context):
|
||||||
db_aggregates = db.aggregate_get_all(context)
|
db_aggregates = db.aggregate_get_all(context)
|
||||||
@@ -152,7 +156,7 @@ class AggregateList(base.ObjectListBase, base.NovaObject):
|
|||||||
db_aggregates)
|
db_aggregates)
|
||||||
|
|
||||||
@base.remotable_classmethod
|
@base.remotable_classmethod
|
||||||
def get_by_host(cls, context, host):
|
def get_by_host(cls, context, host, key=None):
|
||||||
db_aggregates = db.aggregate_get_by_host(context, host)
|
db_aggregates = db.aggregate_get_by_host(context, host, key=key)
|
||||||
return base.obj_make_list(context, AggregateList(), Aggregate,
|
return base.obj_make_list(context, AggregateList(), Aggregate,
|
||||||
db_aggregates)
|
db_aggregates)
|
||||||
|
@@ -133,7 +133,7 @@ class _TestAggregateObject(object):
|
|||||||
|
|
||||||
def test_by_host(self):
|
def test_by_host(self):
|
||||||
self.mox.StubOutWithMock(db, 'aggregate_get_by_host')
|
self.mox.StubOutWithMock(db, 'aggregate_get_by_host')
|
||||||
db.aggregate_get_by_host(self.context, 'fake-host'
|
db.aggregate_get_by_host(self.context, 'fake-host', key=None,
|
||||||
).AndReturn([fake_aggregate])
|
).AndReturn([fake_aggregate])
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
aggs = aggregate.AggregateList.get_by_host(self.context, 'fake-host')
|
aggs = aggregate.AggregateList.get_by_host(self.context, 'fake-host')
|
||||||
|
Reference in New Issue
Block a user