• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python db.aggregate_delete函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_aggregate_host_add

    def test_aggregate_host_add(self):
        aggregate_ref = self._setup_aggregate_with_host()

        self.assertTrue(any([host == 'bar'
                             for host in aggregate_ref['hosts']]))

        db.aggregate_delete(self.context.elevated(), aggregate_ref['id'])
开发者ID:gminator,项目名称:nova,代码行数:7,代码来源:test_conductor.py


示例2: migrate_aggregates

def migrate_aggregates(ctxt, count):
    main_db_ids = _get_main_db_aggregate_ids(ctxt, count)
    if not main_db_ids:
        return 0, 0

    count_all = len(main_db_ids)
    count_hit = 0

    for aggregate_id in main_db_ids:
        try:
            aggregate = Aggregate.get_by_id(ctxt, aggregate_id)
            remove = ['metadata', 'hosts']
            values = {field: getattr(aggregate, field)
                      for field in aggregate.fields if field not in remove}
            _aggregate_create_in_db(ctxt, values, metadata=aggregate.metadata)
            for host in aggregate.hosts:
                _host_add_to_db(ctxt, aggregate_id, host)
            count_hit += 1
            db.aggregate_delete(ctxt, aggregate.id)
        except exception.AggregateNotFound:
            LOG.warning(
                _LW('Aggregate id %(id)i disappeared during migration'),
                {'id': aggregate_id})
        except (exception.AggregateNameExists) as e:
            LOG.error(str(e))

    return count_all, count_hit
开发者ID:4everming,项目名称:nova,代码行数:27,代码来源:aggregate.py


示例3: test_destroy

 def test_destroy(self):
     self.mox.StubOutWithMock(db, 'aggregate_delete')
     db.aggregate_delete(self.context, 123)
     self.mox.ReplayAll()
     agg = aggregate.Aggregate()
     agg.id = 123
     agg.destroy(self.context)
开发者ID:CrazyTeaFs,项目名称:nova,代码行数:7,代码来源:test_aggregate.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))
开发者ID:baz-reddwarf,项目名称:nova,代码行数:7,代码来源:test_db_api.py


示例5: test_aggregate_create_avoid_name_conflict

 def test_aggregate_create_avoid_name_conflict(self):
     """Test we can avoid conflict on deleted aggregates."""
     r1 = _create_aggregate(metadata=None)
     db.aggregate_delete(context.get_admin_context(), r1.id)
     values = {'name': r1.name, 'availability_zone': 'new_zone'}
     r2 = _create_aggregate(values=values)
     self.assertEqual(r2.name, values['name'])
     self.assertEqual(r2.availability_zone, values['availability_zone'])
开发者ID:baz-reddwarf,项目名称:nova,代码行数:8,代码来源:test_db_api.py


示例6: 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


示例7: test_aggregate_create_avoid_name_conflict

 def test_aggregate_create_avoid_name_conflict(self):
     """Test we can avoid conflict on deleted aggregates."""
     r1 = _create_aggregate(metadata=None)
     db.aggregate_delete(context.get_admin_context(), r1.id)
     values = {"name": r1.name, "availability_zone": "new_zone"}
     r2 = _create_aggregate(values=values)
     self.assertEqual(r2.name, values["name"])
     self.assertEqual(r2.availability_zone, values["availability_zone"])
     self.assertEqual(r2.operational_state, "created")
开发者ID:hiteshwadekar,项目名称:nova,代码行数:9,代码来源:test_db_api.py


示例8: 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


示例9: test_aggregate_host_delete

    def test_aggregate_host_delete(self):
        aggregate_ref = self._setup_aggregate_with_host()

        self.conductor.aggregate_host_delete(self.context, aggregate_ref, "bar")

        aggregate_ref = db.aggregate_get(self.context.elevated(), aggregate_ref["id"])

        self.assertFalse(any([host == "bar" for host in aggregate_ref["hosts"]]))

        db.aggregate_delete(self.context.elevated(), aggregate_ref["id"])
开发者ID:jdurgin,项目名称:nova,代码行数:10,代码来源:test_conductor.py


示例10: test_aggregate_create_delete_create_with_metadata

 def test_aggregate_create_delete_create_with_metadata(self):
     """Ensure aggregate metadata is deleted bug 1052479."""
     ctxt = context.get_admin_context()
     result = _create_aggregate(context=ctxt)
     expected_metadata = db.aggregate_metadata_get(ctxt, result['id'])
     self.assertDictMatch(expected_metadata, _get_fake_aggr_metadata())
     db.aggregate_delete(ctxt, result['id'])
     result = _create_aggregate(metadata=None)
     expected_metadata = db.aggregate_metadata_get(ctxt, result['id'])
     self.assertEqual(expected_metadata, {})
开发者ID:hadib,项目名称:nova,代码行数:10,代码来源:test_db_api.py


示例11: 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


示例12: test_aggregate_host_delete

    def test_aggregate_host_delete(self):
        aggregate_ref = self._setup_aggregate_with_host()

        self.conductor.aggregate_host_delete(self.context, aggregate_ref,
                'bar')

        aggregate_ref = db.aggregate_get(self.context.elevated(),
                aggregate_ref['id'])

        self.assertFalse(any([host == 'bar'
                              for host in aggregate_ref['hosts']]))

        db.aggregate_delete(self.context.elevated(), aggregate_ref['id'])
开发者ID:gminator,项目名称:nova,代码行数:13,代码来源:test_conductor.py


示例13: tearDown

 def tearDown(self):
     db.aggregate_delete(self.context, self.agg['id'])
     super(AvailabilityZoneTestCases, self).tearDown()
开发者ID:Juniper,项目名称:nova,代码行数:3,代码来源:test_availability_zones.py


示例14: test_aggregate_get

 def test_aggregate_get(self):
     aggregate_ref = self._setup_aggregate_with_host()
     aggregate = self.conductor.aggregate_get(self.context, aggregate_ref["id"])
     self.assertEqual(jsonutils.to_primitive(aggregate_ref), aggregate)
     db.aggregate_delete(self.context.elevated(), aggregate_ref["id"])
开发者ID:jdurgin,项目名称:nova,代码行数:5,代码来源:test_conductor.py


示例15: test_aggregate_host_add

    def test_aggregate_host_add(self):
        aggregate_ref = self._setup_aggregate_with_host()

        self.assertTrue(any([host == "bar" for host in aggregate_ref["hosts"]]))

        db.aggregate_delete(self.context.elevated(), aggregate_ref["id"])
开发者ID:jdurgin,项目名称:nova,代码行数:6,代码来源:test_conductor.py


示例16: destroy

 def destroy(self, context):
     db.aggregate_delete(context, self.id)
开发者ID:gilmeir,项目名称:nova,代码行数:2,代码来源:aggregate.py


示例17: destroy

 def destroy(self):
     try:
         _aggregate_delete_from_db(self._context, self.id)
     except exception.AggregateNotFound:
         db.aggregate_delete(self._context, self.id)
开发者ID:4everming,项目名称:nova,代码行数:5,代码来源:aggregate.py


示例18: destroy

 def destroy(self):
     db.aggregate_delete(self._context, self.id)
开发者ID:Milstein,项目名称:nova,代码行数:2,代码来源:aggregate.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python db.aggregate_get函数代码示例发布时间:2022-05-27
下一篇:
Python db.aggregate_create函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap