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

Python block_device.legacy_mapping函数代码示例

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

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



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

示例1: test_legacy_mapping_from_object_list

 def test_legacy_mapping_from_object_list(self):
     bdm1 = objects.BlockDeviceMapping()
     bdm1 = objects.BlockDeviceMapping._from_db_object(
         None, bdm1, fake_block_device.FakeDbBlockDeviceDict(
             self.new_mapping[0]))
     bdm2 = objects.BlockDeviceMapping()
     bdm2 = objects.BlockDeviceMapping._from_db_object(
         None, bdm2, fake_block_device.FakeDbBlockDeviceDict(
             self.new_mapping[1]))
     bdmlist = objects.BlockDeviceMappingList()
     bdmlist.objects = [bdm1, bdm2]
     block_device.legacy_mapping(bdmlist)
开发者ID:aaaaatoz,项目名称:nova,代码行数:12,代码来源:test_block_device.py


示例2: block_device_mapping_get_all_by_instance

 def block_device_mapping_get_all_by_instance(self, context, instance,
                                              legacy=True):
     bdms = db.block_device_mapping_get_all_by_instance(context,
                                                        instance['uuid'])
     if legacy:
         bdms = block_device.legacy_mapping(bdms)
     return bdms
开发者ID:Yuriy-Leonov,项目名称:nova,代码行数:7,代码来源:fake.py


示例3: block_device_mapping_get_all_by_instance

 def block_device_mapping_get_all_by_instance(self, context, instance,
                                              legacy):
     bdms = self.db.block_device_mapping_get_all_by_instance(
         context, instance['uuid'])
     if legacy:
         bdms = block_device.legacy_mapping(bdms)
     return jsonutils.to_primitive(bdms)
开发者ID:VinceOnGit,项目名称:nova,代码行数:7,代码来源:manager.py


示例4: rebuild_instance

    def rebuild_instance(self, ctxt, instance, new_pass, injected_files,
            image_ref, orig_image_ref, orig_sys_metadata, bdms,
            recreate=False, on_shared_storage=False, host=None,
            preserve_ephemeral=False, kwargs=None):
        # NOTE(danms): kwargs is only here for cells compatibility, don't
        # actually send it to compute
        extra = {'preserve_ephemeral': preserve_ephemeral}
        if self.client.can_send_version('3.21'):
            version = '3.21'
        else:
            bdms = block_device.legacy_mapping(bdms)
            bdms = jsonutils.to_primitive(objects_base.obj_to_primitive(bdms))
            if self.client.can_send_version('3.5'):
                version = '3.5'
            elif self.client.can_send_version('3.4'):
                version = '3.4'
                extra = {}
            else:
                # NOTE(russellb) Havana compat
                version = self._get_compat_version('3.0', '2.22')
                instance = jsonutils.to_primitive(instance)
                extra = {}

        cctxt = self.client.prepare(server=_compute_host(host, instance),
                version=version)
        cctxt.cast(ctxt, 'rebuild_instance',
                   instance=instance, new_pass=new_pass,
                   injected_files=injected_files, image_ref=image_ref,
                   orig_image_ref=orig_image_ref,
                   orig_sys_metadata=orig_sys_metadata, bdms=bdms,
                   recreate=recreate, on_shared_storage=on_shared_storage,
                   **extra)
开发者ID:KumarAcharya,项目名称:nova,代码行数:32,代码来源:rpcapi.py


示例5: _handle_cell_delete

    def _handle_cell_delete(self, context, instance, method_name):
        if not instance.cell_name:
            delete_type = method_name == 'soft_delete' and 'soft' or 'hard'
            self.cells_rpcapi.instance_delete_everywhere(context,
                    instance, delete_type)
            bdms = block_device.legacy_mapping(
                self.db.block_device_mapping_get_all_by_instance(
                    context, instance.uuid))
            # NOTE(danms): If we try to delete an instance with no cell,
            # there isn't anything to salvage, so we can hard-delete here.
            try:
                super(ComputeCellsAPI, self)._local_delete(context, instance,
                                                           bdms, method_name,
                                                           self._do_delete)
            except exception.ObjectActionError:
                # NOTE(alaski): We very likely got here because the host
                # constraint in instance.destroy() failed.  This likely means
                # that an update came up from a child cell and cell_name is
                # set now.  If so try the delete again.
                with excutils.save_and_reraise_exception() as exc:
                    instance.refresh()
                    if instance.cell_name:
                        exc.reraise = False
                        self._handle_cell_delete(context, instance,
                                method_name)
            return

        method = getattr(super(ComputeCellsAPI, self), method_name)
        method(context, instance)
开发者ID:Milstein,项目名称:nova,代码行数:29,代码来源:cells_api.py


示例6: _handle_cell_delete

    def _handle_cell_delete(self, context, instance, method_name):
        if not instance.cell_name:
            delete_type = method_name == "soft_delete" and "soft" or "hard"
            self.cells_rpcapi.instance_delete_everywhere(context, instance, delete_type)
            bdms = block_device.legacy_mapping(self.db.block_device_mapping_get_all_by_instance(context, instance.uuid))
            # NOTE(danms): If we try to delete an instance with no cell,
            # there isn't anything to salvage, so we can hard-delete here.
            try:
                super(ComputeCellsAPI, self)._local_delete(context, instance, bdms, method_name, self._do_delete)
            except exception.ObjectActionError:
                # NOTE(alaski): We very likely got here because the host
                # constraint in instance.destroy() failed.  This likely means
                # that an update came up from a child cell and cell_name is
                # set now.  If so try the delete again.
                with excutils.save_and_reraise_exception() as exc:
                    try:
                        instance.refresh()
                    except exception.InstanceNotFound:
                        # NOTE(melwitt): If the instance has already been
                        # deleted by instance_destroy_at_top from a cell,
                        # instance.refresh() will raise InstanceNotFound.
                        exc.reraise = False
                    else:
                        if instance.cell_name:
                            exc.reraise = False
                            self._handle_cell_delete(context, instance, method_name)
            except exception.InstanceNotFound:
                # NOTE(melwitt): We can get here if anything tries to
                # lookup the instance after a instance_destroy_at_top hits.
                pass
            return

        method = getattr(super(ComputeCellsAPI, self), method_name)
        method(context, instance)
开发者ID:isyippee,项目名称:nova,代码行数:34,代码来源:cells_api.py


示例7: terminate_instance

 def terminate_instance(self, ctxt, instance, bdms, reservations=None):
     # NOTE(russellb) Havana compat
     if self.client.can_send_version("3.22"):
         version = "3.22"
     else:
         version = self._get_compat_version("3.0", "2.35")
         bdms = block_device.legacy_mapping(bdms)
         bdms = jsonutils.to_primitive(objects_base.obj_to_primitive(bdms))
     cctxt = self.client.prepare(server=_compute_host(None, instance), version=version)
     cctxt.cast(ctxt, "terminate_instance", instance=instance, bdms=bdms, reservations=reservations)
开发者ID:ngsdevops,项目名称:nova,代码行数:10,代码来源:rpcapi.py


示例8: _handle_cell_delete

    def _handle_cell_delete(self, context, instance, method_name):
        if not instance["cell_name"]:
            delete_type = method_name == "soft_delete" and "soft" or "hard"
            self.cells_rpcapi.instance_delete_everywhere(context, instance, delete_type)
            bdms = block_device.legacy_mapping(
                self.db.block_device_mapping_get_all_by_instance(context, instance["uuid"])
            )
            # NOTE(danms): If we try to delete an instance with no cell,
            # there isn't anything to salvage, so we can hard-delete here.
            super(ComputeCellsAPI, self)._local_delete(context, instance, bdms, method_name, self._do_delete)
            return

        method = getattr(super(ComputeCellsAPI, self), method_name)
        method(context, instance)
开发者ID:humble00,项目名称:nova,代码行数:14,代码来源:cells_api.py


示例9: test_legacy_mapping_source_image

    def test_legacy_mapping_source_image(self):
        got_legacy = block_device.legacy_mapping(self.new_mapping)

        for legacy, expected in zip(got_legacy, self.legacy_mapping):
            self.assertThat(expected, matchers.IsSubDictOf(legacy))
开发者ID:aaaaatoz,项目名称:nova,代码行数:5,代码来源:test_block_device.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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