当前位置: 首页>>代码示例>>Python>>正文


Python db.aggregate_get_all函数代码示例

本文整理汇总了Python中nova.db.aggregate_get_all函数的典型用法代码示例。如果您正苦于以下问题:Python aggregate_get_all函数的具体用法?Python aggregate_get_all怎么用?Python aggregate_get_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了aggregate_get_all函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_all

 def test_get_all(self):
     self.mox.StubOutWithMock(db, 'aggregate_get_all')
     db.aggregate_get_all(self.context).AndReturn([fake_aggregate])
     self.mox.ReplayAll()
     aggs = aggregate.AggregateList.get_all(self.context)
     self.assertEqual(1, len(aggs))
     self.compare_obj(aggs[0], fake_aggregate, subs=SUBS)
开发者ID:CrazyTeaFs,项目名称:nova,代码行数:7,代码来源:test_aggregate.py

示例2: test_migration

 def test_migration(self):
     db.aggregate_create(self.context, {'name': 'foo'})
     main_aggregates_len = len(db.aggregate_get_all(self.context))
     match, done = aggregate_obj.migrate_aggregates(self.context, 50)
     self.assertEqual(1, main_aggregates_len)
     self.assertEqual(main_aggregates_len, match)
     self.assertEqual(main_aggregates_len, done)
     self.assertEqual(0, len(db.aggregate_get_all(self.context)))
     self.assertEqual(main_aggregates_len,
                      len(aggregate_obj.AggregateList.get_all(
                                                             self.context)))
开发者ID:4everming,项目名称:nova,代码行数:11,代码来源:test_aggregate.py

示例3: test_aggregate_delete

 def test_aggregate_delete(self):
     """Ensure we can delete an aggregate."""
     ctxt = context.get_admin_context()
     result = _create_aggregate(context=ctxt, metadata=None)
     db.aggregate_delete(ctxt, result['id'])
     expected = db.aggregate_get_all(ctxt, read_deleted='no')
     self.assertEqual(0, len(expected))
开发者ID:baz-reddwarf,项目名称:nova,代码行数:7,代码来源:test_db_api.py

示例4: test_aggregate_delete

 def test_aggregate_delete(self):
     """Ensure we can delete an aggregate."""
     ctxt = context.get_admin_context()
     result = _create_aggregate(context=ctxt, metadata=None)
     db.aggregate_delete(ctxt, result['id'])
     expected = db.aggregate_get_all(ctxt, read_deleted='no')
     self.assertEqual(0, len(expected))
     aggregate = db.aggregate_get(ctxt, result['id'], read_deleted='yes')
     self.assertEqual(aggregate["operational_state"], "dismissed")
开发者ID:alejuanito,项目名称:nova,代码行数:9,代码来源:test_db_api.py

示例5: test_aggregate_delete

 def test_aggregate_delete(self):
     """Ensure we can delete an aggregate."""
     ctxt = context.get_admin_context()
     result = _create_aggregate(context=ctxt, metadata=None)
     db.aggregate_delete(ctxt, result["id"])
     expected = db.aggregate_get_all(ctxt)
     self.assertEqual(0, len(expected))
     aggregate = db.aggregate_get(ctxt.elevated(read_deleted="yes"), result["id"])
     self.assertEqual(aggregate.deleted, True)
开发者ID:NewpTone,项目名称:stacklab-nova,代码行数:9,代码来源:test_db_api.py

示例6: test_aggregate_get_all

 def test_aggregate_get_all(self):
     """Ensure we can get all aggregates."""
     ctxt = context.get_admin_context()
     counter = 3
     for c in xrange(counter):
         _create_aggregate(context=ctxt,
                           values={'name': 'fake_aggregate_%d' % c,
                                   'availability_zone': 'fake_avail_zone'},
                           metadata=None)
     results = db.aggregate_get_all(ctxt)
     self.assertEqual(len(results), counter)
开发者ID:matiu2,项目名称:nova,代码行数:11,代码来源:test_db_api.py

示例7: test_aggregate_get_all_non_deleted

 def test_aggregate_get_all_non_deleted(self):
     """Ensure we get only non-deleted aggregates."""
     ctxt = context.get_admin_context()
     add_counter = 5
     remove_counter = 2
     aggregates = []
     for c in xrange(1, add_counter):
         values = {"name": "fake_aggregate_%d" % c, "availability_zone": "fake_avail_zone"}
         aggregates.append(_create_aggregate(context=ctxt, values=values, metadata=None))
     for c in xrange(1, remove_counter):
         db.aggregate_delete(ctxt, aggregates[c - 1].id)
     results = db.aggregate_get_all(ctxt)
     self.assertEqual(len(results), add_counter - remove_counter)
开发者ID:hiteshwadekar,项目名称:nova,代码行数:13,代码来源:test_db_api.py

示例8: get_all

 def get_all(cls, context):
     db_aggregates = db.aggregate_get_all(context)
     return base.obj_make_list(context, cls(context), objects.Aggregate, db_aggregates)
开发者ID:gilmeir,项目名称:nova,代码行数:3,代码来源:aggregate.py

示例9: get_all

 def get_all(cls, context):
     db_aggregates = db.aggregate_get_all(context)
     return base.obj_make_list(context, AggregateList(), Aggregate,
                               db_aggregates)
开发者ID:B-Rich,项目名称:nova-1,代码行数:4,代码来源:aggregate.py

示例10: get_all

 def get_all(cls, context):
     api_db_aggregates = [cls._fill_deprecated(agg) for agg in
                             _get_all_from_db(context)]
     db_aggregates = db.aggregate_get_all(context)
     return base.obj_make_list(context, cls(context), objects.Aggregate,
                               db_aggregates + api_db_aggregates)
开发者ID:4everming,项目名称:nova,代码行数:6,代码来源:aggregate.py


注:本文中的nova.db.aggregate_get_all函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。