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

Python api.set_quota_usage_dirty函数代码示例

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

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



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

示例1: test_create_delete_network_marks_dirty

 def test_create_delete_network_marks_dirty(self):
     self._test_init('network')
     net = self._make_network('json', 'meh', True)['network']
     self._verify_dirty_bit('network')
     # Clear the dirty bit
     quota_db_api.set_quota_usage_dirty(
         self.ctx, 'network', self._tenant_id, dirty=False)
     self._delete('networks', net['id'])
     self._verify_dirty_bit('network')
开发者ID:cubeek,项目名称:neutron,代码行数:9,代码来源:test_tracked_resources.py


示例2: test_create_delete_securitygroup_marks_dirty

 def test_create_delete_securitygroup_marks_dirty(self):
     self._test_init('security_group')
     sec_group = self._make_security_group(
         'json', 'meh', 'meh', tenant_id=self._tenant_id)['security_group']
     self._verify_dirty_bit('security_group')
     # Clear the dirty bit
     quota_db_api.set_quota_usage_dirty(
         self.ctx, 'security_group', self._tenant_id, dirty=False)
     self._delete('security-groups', sec_group['id'])
     self._verify_dirty_bit('security_group')
开发者ID:cubeek,项目名称:neutron,代码行数:10,代码来源:test_tracked_resources.py


示例3: mark_dirty

 def mark_dirty(self, context, nested=False):
     if not self._dirty_tenants:
         return
     with context.session.begin(nested=nested, subtransactions=True):
         for tenant_id in self._dirty_tenants:
             quota_api.set_quota_usage_dirty(context, self.name, tenant_id)
             LOG.debug(("Persisted dirty status for tenant:%(tenant_id)s "
                        "on resource:%(resource)s"),
                       {'tenant_id': tenant_id, 'resource': self.name})
     self._out_of_sync_tenants |= self._dirty_tenants
     self._dirty_tenants.clear()
开发者ID:cisco-openstack,项目名称:neutron,代码行数:11,代码来源:resource.py


示例4: test_create_delete_subnetpool_marks_dirty

 def test_create_delete_subnetpool_marks_dirty(self):
     self._test_init('subnetpool')
     pool = self._make_subnetpool('json', ['10.0.0.0/8'],
                                  name='meh',
                                  tenant_id=self._tenant_id)['subnetpool']
     self._verify_dirty_bit('subnetpool')
     # Clear the dirty bit
     quota_db_api.set_quota_usage_dirty(
         self.ctx, 'subnetpool', self._tenant_id, dirty=False)
     self._delete('subnetpools', pool['id'])
     self._verify_dirty_bit('subnetpool')
开发者ID:cubeek,项目名称:neutron,代码行数:11,代码来源:test_tracked_resources.py


示例5: test_create_delete_subnet_marks_dirty

 def test_create_delete_subnet_marks_dirty(self):
     self._test_init('subnet')
     net = self._make_network('json', 'meh', True)
     subnet = self._make_subnet('json', net, '10.0.0.1',
                                '10.0.0.0/24')['subnet']
     self._verify_dirty_bit('subnet')
     # Clear the dirty bit
     quota_db_api.set_quota_usage_dirty(
         self.ctx, 'subnet', self._tenant_id, dirty=False)
     self._delete('subnets', subnet['id'])
     self._verify_dirty_bit('subnet')
开发者ID:cubeek,项目名称:neutron,代码行数:11,代码来源:test_tracked_resources.py


示例6: test_create_delete_securitygrouprule_marks_dirty

 def test_create_delete_securitygrouprule_marks_dirty(self):
     self._test_init('security_group_rule')
     sec_group = self._make_security_group(
         'json', 'meh', 'meh', tenant_id=self._tenant_id)['security_group']
     rule_req = self._build_security_group_rule(
         sec_group['id'], 'ingress', 'TCP', tenant_id=self._tenant_id)
     sec_group_rule = self._make_security_group_rule(
         'json', rule_req)['security_group_rule']
     self._verify_dirty_bit('security_group_rule')
     # Clear the dirty bit
     quota_db_api.set_quota_usage_dirty(
         self.ctx, 'security_group_rule', self._tenant_id, dirty=False)
     self._delete('security-group-rules', sec_group_rule['id'])
     self._verify_dirty_bit('security_group_rule')
开发者ID:cubeek,项目名称:neutron,代码行数:14,代码来源:test_tracked_resources.py


示例7: mark_dirty

 def mark_dirty(self, context):
     if not self._dirty_tenants:
         return
     with db_api.context_manager.writer.using(context):
         # It is not necessary to protect this operation with a lock.
         # Indeed when this method is called the request has been processed
         # and therefore all resources created or deleted.
         # dirty_tenants will contain all the tenants for which the
         # resource count is changed. The list might contain also tenants
         # for which resource count was altered in other requests, but this
         # won't be harmful.
         dirty_tenants_snap = self._dirty_tenants.copy()
         for tenant_id in dirty_tenants_snap:
             quota_api.set_quota_usage_dirty(context, self.name, tenant_id)
     self._out_of_sync_tenants |= dirty_tenants_snap
     self._dirty_tenants -= dirty_tenants_snap
开发者ID:huntxu,项目名称:neutron,代码行数:16,代码来源:resource.py


示例8: test_set_quota_usage_dirty

 def test_set_quota_usage_dirty(self):
     self._create_quota_usage('goals', 26)
     # Higuain needs a shower after the match
     self.assertEqual(1, quota_api.set_quota_usage_dirty(
         self.context, 'goals', self.tenant_id))
     usage_info = quota_api.get_quota_usage_by_resource_and_tenant(
         self.context, 'goals', self.tenant_id)
     self._verify_quota_usage(usage_info,
                              expected_dirty=True)
     # Higuain is clean now
     self.assertEqual(1, quota_api.set_quota_usage_dirty(
         self.context, 'goals', self.tenant_id, dirty=False))
     usage_info = quota_api.get_quota_usage_by_resource_and_tenant(
         self.context, 'goals', self.tenant_id)
     self._verify_quota_usage(usage_info,
                              expected_dirty=False)
开发者ID:cubeek,项目名称:neutron,代码行数:16,代码来源:test_api.py


示例9: mark_dirty

 def mark_dirty(self, context, nested=False):
     if not self._dirty_tenants:
         return
     with context.session.begin(nested=nested, subtransactions=True):
         # It is not necessary to protect this operation with a lock.
         # Indeed when this method is called the request has been processed
         # and therefore all resources created or deleted.
         # dirty_tenants will contain all the tenants for which the
         # resource count is changed. The list might contain also tenants
         # for which resource count was altered in other requests, but this
         # won't be harmful.
         dirty_tenants_snap = self._dirty_tenants.copy()
         for tenant_id in dirty_tenants_snap:
             quota_api.set_quota_usage_dirty(context, self.name, tenant_id)
             LOG.debug(("Persisted dirty status for tenant:%(tenant_id)s "
                        "on resource:%(resource)s"),
                       {'tenant_id': tenant_id, 'resource': self.name})
     self._out_of_sync_tenants |= dirty_tenants_snap
     self._dirty_tenants = self._dirty_tenants - dirty_tenants_snap
开发者ID:prophaner,项目名称:neutron,代码行数:19,代码来源:resource.py


示例10: test_set_resources_quota_usage_dirty_with_empty_list

    def test_set_resources_quota_usage_dirty_with_empty_list(self):
        self._create_quota_usage('goals', 26)
        self._create_quota_usage('assists', 11)
        self._create_quota_usage('bookings', 3)
        # Expect all the resources for the tenant to be set dirty
        self.assertEqual(3, quota_api.set_resources_quota_usage_dirty(
            self.context, [], self.tenant_id))
        usage_info_goals = quota_api.get_quota_usage_by_resource_and_tenant(
            self.context, 'goals', self.tenant_id)
        usage_info_assists = quota_api.get_quota_usage_by_resource_and_tenant(
            self.context, 'assists', self.tenant_id)
        usage_info_bookings = quota_api.get_quota_usage_by_resource_and_tenant(
            self.context, 'bookings', self.tenant_id)
        self._verify_quota_usage(usage_info_goals, expected_dirty=True)
        self._verify_quota_usage(usage_info_assists, expected_dirty=True)
        self._verify_quota_usage(usage_info_bookings, expected_dirty=True)

        # Higuain is clean now
        self.assertEqual(1, quota_api.set_quota_usage_dirty(
            self.context, 'goals', self.tenant_id, dirty=False))
        usage_info = quota_api.get_quota_usage_by_resource_and_tenant(
            self.context, 'goals', self.tenant_id)
        self._verify_quota_usage(usage_info,
                                 expected_dirty=False)
开发者ID:cubeek,项目名称:neutron,代码行数:24,代码来源:test_api.py


示例11: test_set_dirty_non_existing_quota_usage

 def test_set_dirty_non_existing_quota_usage(self):
     self.assertEqual(0, quota_api.set_quota_usage_dirty(
         self.context, 'meh', self.tenant_id))
开发者ID:cubeek,项目名称:neutron,代码行数:3,代码来源:test_api.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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