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

Python db.floating_ip_destroy函数代码示例

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

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



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

示例1: test_ip_association_and_allocation_of_other_project

    def test_ip_association_and_allocation_of_other_project(self):
        """Makes sure that we cannot deallocaate or disassociate
        a public ip of other project"""

        context1 = context.RequestContext("user", "project1")
        context2 = context.RequestContext("user", "project2")

        address = "1.2.3.4"
        float_addr = db.floating_ip_create(context1.elevated(), {"address": address, "project_id": context1.project_id})

        instance = db.instance_create(context1, {"project_id": "project1"})

        fix_addr = db.fixed_ip_associate_pool(context1.elevated(), 1, instance["id"])

        # Associate the IP with non-admin user context
        self.assertRaises(exception.NotAuthorized, self.network.associate_floating_ip, context2, float_addr, fix_addr)

        # Deallocate address from other project
        self.assertRaises(exception.NotAuthorized, self.network.deallocate_floating_ip, context2, float_addr)

        # Now Associates the address to the actual project
        self.network.associate_floating_ip(context1, float_addr, fix_addr)

        # Now try dis-associating from other project
        self.assertRaises(exception.NotAuthorized, self.network.disassociate_floating_ip, context2, float_addr)

        # Clean up the ip addresses
        self.network.deallocate_floating_ip(context1, float_addr)
        self.network.deallocate_fixed_ip(context1, fix_addr)
        db.floating_ip_destroy(context1.elevated(), float_addr)
        db.fixed_ip_disassociate(context1.elevated(), fix_addr)
开发者ID:nicoleLiu,项目名称:nova,代码行数:31,代码来源:test_network.py


示例2: test_public_network_association

 def test_public_network_association(self):
     """Makes sure that we can allocaate a public ip"""
     # TODO(vish): better way of adding floating ips
     self.context._project = self.projects[0]
     self.context.project_id = self.projects[0].id
     pubnet = IPy.IP(flags.FLAGS.floating_range)
     address = str(pubnet[0])
     try:
         db.floating_ip_get_by_address(context.get_admin_context(), address)
     except exception.NotFound:
         db.floating_ip_create(context.get_admin_context(),
                               {'address': address,
                                'host': FLAGS.host})
     float_addr = self.network.allocate_floating_ip(self.context,
                                                    self.projects[0].id)
     fix_addr = self._create_address(0)
     lease_ip(fix_addr)
     self.assertEqual(float_addr, str(pubnet[0]))
     self.network.associate_floating_ip(self.context, float_addr, fix_addr)
     address = db.instance_get_floating_address(context.get_admin_context(),
                                                self.instance_id)
     self.assertEqual(address, float_addr)
     self.network.disassociate_floating_ip(self.context, float_addr)
     address = db.instance_get_floating_address(context.get_admin_context(),
                                                self.instance_id)
     self.assertEqual(address, None)
     self.network.deallocate_floating_ip(self.context, float_addr)
     self.network.deallocate_fixed_ip(self.context, fix_addr)
     release_ip(fix_addr)
     db.floating_ip_destroy(context.get_admin_context(), float_addr)
开发者ID:anotherjesse,项目名称:nova,代码行数:30,代码来源:test_network.py


示例3: test_too_many_addresses

 def test_too_many_addresses(self):
     address = '192.168.0.100'
     db.floating_ip_create(context.get_admin_context(),
                           {'address': address,
                            'project_id': self.project_id})
     self.assertRaises(quota.QuotaError,
                       self.network.allocate_floating_ip,
                       self.context,
                       self.project_id)
     db.floating_ip_destroy(context.get_admin_context(), address)
开发者ID:AsherBond,项目名称:dodai-compute,代码行数:10,代码来源:test_quota.py


示例4: test_too_many_addresses

 def test_too_many_addresses(self):
     address = "192.168.0.100"
     db.floating_ip_create(context.get_admin_context(), {"address": address, "host": FLAGS.host})
     float_addr = self.network.allocate_floating_ip(self.context, self.project.id)
     # NOTE(vish): This assert never fails. When cloud attempts to
     #             make an rpc.call, the test just finishes with OK. It
     #             appears to be something in the magic inline callbacks
     #             that is breaking.
     self.assertRaises(quota.QuotaError, network.API().allocate_floating_ip, self.context)
     db.floating_ip_destroy(context.get_admin_context(), address)
开发者ID:superstack,项目名称:nova,代码行数:10,代码来源:test_quota.py


示例5: test_describe_addresses

 def test_describe_addresses(self):
     """Makes sure describe addresses runs without raising an exception"""
     address = "10.10.10.10"
     db.floating_ip_create(self.context,
                           {'address': address,
                            'host': self.network.host})
     self.cloud.allocate_address(self.context)
     self.cloud.describe_addresses(self.context)
     self.cloud.release_address(self.context,
                               public_ip=address)
     greenthread.sleep(0.3)
     db.floating_ip_destroy(self.context, address)
开发者ID:yosh,项目名称:nova,代码行数:12,代码来源:test_cloud.py


示例6: test_post_live_migration_working_correctly

    def test_post_live_migration_working_correctly(self):
        """Confirm post_live_migration() works as expected correctly."""
        dest = 'desthost'
        flo_addr = '1.2.1.2'

        # Preparing datas
        c = context.get_admin_context()
        instance_id = self._create_instance()
        i_ref = db.instance_get(c, instance_id)
        db.instance_update(c, i_ref['id'], {'state_description': 'migrating',
                                            'state': power_state.PAUSED})
        v_ref = db.volume_create(c, {'size': 1, 'instance_id': instance_id})
        fix_addr = db.fixed_ip_create(c, {'address': '1.1.1.1',
                                          'instance_id': instance_id})
        fix_ref = db.fixed_ip_get_by_address(c, fix_addr)
        flo_ref = db.floating_ip_create(c, {'address': flo_addr,
                                        'fixed_ip_id': fix_ref['id']})
        # reload is necessary before setting mocks
        i_ref = db.instance_get(c, instance_id)

        # Preparing mocks
        self.mox.StubOutWithMock(self.compute.volume_manager,
                                 'remove_compute_volume')
        for v in i_ref['volumes']:
            self.compute.volume_manager.remove_compute_volume(c, v['id'])
        self.mox.StubOutWithMock(self.compute.driver, 'unfilter_instance')
        self.compute.driver.unfilter_instance(i_ref, [])

        # executing
        self.mox.ReplayAll()
        ret = self.compute.post_live_migration(c, i_ref, dest)

        # make sure every data is rewritten to dest
        i_ref = db.instance_get(c, i_ref['id'])
        c1 = (i_ref['host'] == dest)
        flo_refs = db.floating_ip_get_all_by_host(c, dest)
        c2 = (len(flo_refs) != 0 and flo_refs[0]['address'] == flo_addr)

        # post operaton
        self.assertTrue(c1 and c2)
        db.instance_destroy(c, instance_id)
        db.volume_destroy(c, v_ref['id'])
        db.floating_ip_destroy(c, flo_addr)
开发者ID:cp16net,项目名称:reddwarf,代码行数:43,代码来源:test_compute.py


示例7: test_associate_disassociate_address

 def test_associate_disassociate_address(self):
     """Verifies associate runs cleanly without raising an exception"""
     address = "10.10.10.10"
     db.floating_ip_create(self.context,
                           {'address': address,
                            'host': self.network.host})
     self.cloud.allocate_address(self.context)
     inst = db.instance_create(self.context, {'host': self.compute.host})
     fixed = self.network.allocate_fixed_ip(self.context, inst['id'])
     ec2_id = cloud.id_to_ec2_id(inst['id'])
     self.cloud.associate_address(self.context,
                                  instance_id=ec2_id,
                                  public_ip=address)
     greenthread.sleep(0.3)
     self.cloud.disassociate_address(self.context,
                                     public_ip=address)
     self.cloud.release_address(self.context,
                               public_ip=address)
     greenthread.sleep(0.3)
     self.network.deallocate_fixed_ip(self.context, fixed)
     db.instance_destroy(self.context, inst['id'])
     db.floating_ip_destroy(self.context, address)
开发者ID:yosh,项目名称:nova,代码行数:22,代码来源:test_cloud.py


示例8: _delete_floating_ip

 def _delete_floating_ip(self):
     db.floating_ip_destroy(self.context, testaddress)
开发者ID:rbenali,项目名称:nova,代码行数:2,代码来源:test_floating_ip_dns.py


示例9: _delete_floating_ip

 def _delete_floating_ip(self):
     db.floating_ip_destroy(self.context, self.floating_ip)
开发者ID:A7Zulu,项目名称:nova,代码行数:2,代码来源:test_floating_ips.py


示例10: destroy

 def destroy(cls, context, address):
     db.floating_ip_destroy(context, str(address))
开发者ID:EliseCheng,项目名称:nova,代码行数:2,代码来源:floating_ip.py


示例11: test_too_many_addresses

 def test_too_many_addresses(self):
     address = "192.168.0.100"
     db.floating_ip_create(context.get_admin_context(), {"address": address, "project_id": self.project_id})
     self.assertRaises(exception.QuotaError, self.network.allocate_floating_ip, self.context, self.project_id)
     db.floating_ip_destroy(context.get_admin_context(), address)
开发者ID:renuka-apte,项目名称:nova,代码行数:5,代码来源:test_quota.py


示例12: delete

 def delete(self, ip_range):
     """Deletes floating ips by range"""
     for address in self.address_to_hosts(ip_range):
         db.floating_ip_destroy(context.get_admin_context(),
                                str(address))
开发者ID:pubfox,项目名称:webservices,代码行数:5,代码来源:wic_floating.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python db.floating_ip_get函数代码示例发布时间:2022-05-27
下一篇:
Python db.floating_ip_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