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

Python db.flavor_extra_specs_get函数代码示例

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

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



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

示例1: test_build_request_spec_without_image

    def test_build_request_spec_without_image(self):
        image = None
        instance = {'uuid': 'fake-uuid'}
        instance_type = {'flavorid': 'fake-id'}

        self.mox.StubOutWithMock(flavors, 'extract_flavor')
        self.mox.StubOutWithMock(db, 'flavor_extra_specs_get')
        flavors.extract_flavor(mox.IgnoreArg()).AndReturn(instance_type)
        db.flavor_extra_specs_get(self.context, mox.IgnoreArg()).AndReturn([])
        self.mox.ReplayAll()

        request_spec = scheduler_utils.build_request_spec(self.context, image,
                                                          [instance])
        self.assertEqual({}, request_spec['image'])
开发者ID:hoomri,项目名称:nova,代码行数:14,代码来源:test_scheduler_utils.py


示例2: build_request_spec

def build_request_spec(ctxt, image, instances, instance_type=None):
    """Build a request_spec for the scheduler.

    The request_spec assumes that all instances to be scheduled are the same
    type.
    """
    instance = instances[0]
    if isinstance(instance, obj_base.NovaObject):
        instance = obj_base.obj_to_primitive(instance)

    if instance_type is None:
        instance_type = flavors.extract_flavor(instance)
    # NOTE(comstud): This is a bit ugly, but will get cleaned up when
    # we're passing an InstanceType internal object.
    extra_specs = db.flavor_extra_specs_get(ctxt, instance_type['flavorid'])
    instance_type['extra_specs'] = extra_specs
    request_spec = {
            'image': image or {},
            'instance_properties': instance,
            'instance_type': instance_type,
            'num_instances': len(instances),
            # NOTE(alaski): This should be removed as logic moves from the
            # scheduler to conductor.  Provides backwards compatibility now.
            'instance_uuids': [inst['uuid'] for inst in instances]}
    return jsonutils.to_primitive(request_spec)
开发者ID:YankunLi,项目名称:nova,代码行数:25,代码来源:utils.py


示例3: test_flavor_extra_specs_delete

 def test_flavor_extra_specs_delete(self):
     del self.specs["xpu_model"]
     db.flavor_extra_specs_delete(self.context,
                                  self.flavorid,
                                  "xpu_model")
     actual_specs = db.flavor_extra_specs_get(
                           self.context,
                           self.flavorid)
     self.assertEqual(self.specs, actual_specs)
开发者ID:dlq84,项目名称:nova,代码行数:9,代码来源:test_instance_types_extra_specs.py


示例4: test_extra_specs_update

    def test_extra_specs_update(self):
        expected_specs = {'k1': 'v1'}
        updated_specs = {'k1': 'v2'}

        self._test_extra_specs_empty()

        self.set_key(self.instance_type_name, "k1", "v1")
        actual_specs = db.flavor_extra_specs_get(
                              context.get_admin_context(),
                              self.instance_type_flavorid)
        self.assertEquals(expected_specs, actual_specs)

        self.set_key(self.instance_type_name, "k1", "v2")
        actual_specs = db.flavor_extra_specs_get(
                              context.get_admin_context(),
                              self.instance_type_flavorid)
        self.assertEquals(updated_specs, actual_specs)

        self.unset_key(self.instance_type_name, "k1")
开发者ID:iBeacons,项目名称:nova,代码行数:19,代码来源:test_nova_manage.py


示例5: test_instance_type_extra_specs_update

 def test_instance_type_extra_specs_update(self):
     self.specs["cpu_model"] = "Sandy Bridge"
     db.flavor_extra_specs_update_or_create(
                           self.context,
                           self.flavorid,
                           dict(cpu_model="Sandy Bridge"))
     actual_specs = db.flavor_extra_specs_get(
                           self.context,
                           self.flavorid)
     self.assertEqual(self.specs, actual_specs)
开发者ID:dlq84,项目名称:nova,代码行数:10,代码来源:test_instance_types_extra_specs.py


示例6: test_instance_type_specs_get

 def test_instance_type_specs_get(self):
     expected_specs = dict(cpu_arch="x86_64",
                              cpu_model="Nehalem",
                              xpu_arch="fermi",
                              xpus="2",
                              xpu_model="Tesla 2050")
     actual_specs = db.flavor_extra_specs_get(
                           self.context,
                           self.flavorid)
     self.assertEquals(expected_specs, actual_specs)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:10,代码来源:test_instance_types_extra_specs.py


示例7: test_instance_type_extra_specs_create

 def test_instance_type_extra_specs_create(self):
     net_attrs = {
         "net_arch": "ethernet",
         "net_mbps": "10000"
     }
     self.specs.update(net_attrs)
     db.flavor_extra_specs_update_or_create(
                           self.context,
                           self.flavorid,
                           net_attrs)
     actual_specs = db.flavor_extra_specs_get(
                           self.context,
                           self.flavorid)
     self.assertEqual(self.specs, actual_specs)
开发者ID:dlq84,项目名称:nova,代码行数:14,代码来源:test_instance_types_extra_specs.py


示例8: test_instance_type_extra_specs_update

 def test_instance_type_extra_specs_update(self):
     expected_specs = dict(cpu_arch="x86_64",
                              cpu_model="Sandy Bridge",
                              xpu_arch="fermi",
                              xpus="2",
                              xpu_model="Tesla 2050")
     db.flavor_extra_specs_update_or_create(
                           self.context,
                           self.flavorid,
                           dict(cpu_model="Sandy Bridge"))
     actual_specs = db.flavor_extra_specs_get(
                           self.context,
                           self.flavorid)
     self.assertEquals(expected_specs, actual_specs)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:14,代码来源:test_instance_types_extra_specs.py


示例9: test_extra_specs_multiple

    def test_extra_specs_multiple(self):
        two_items_extra_specs = {'k1': 'v1',
                                'k3': 'v3'}

        self._test_extra_specs_empty()

        self.set_key(self.instance_type_name, "k1", "v1")
        self.set_key(self.instance_type_name, "k3", "v3")
        actual_specs = db.flavor_extra_specs_get(
                              context.get_admin_context(),
                              self.instance_type_flavorid)
        self.assertEquals(two_items_extra_specs, actual_specs)

        self.unset_key(self.instance_type_name, "k1")
        self.unset_key(self.instance_type_name, "k3")
开发者ID:iBeacons,项目名称:nova,代码行数:15,代码来源:test_nova_manage.py


示例10: test_instance_type_extra_specs_create

 def test_instance_type_extra_specs_create(self):
     expected_specs = dict(cpu_arch="x86_64",
                              cpu_model="Nehalem",
                              xpu_arch="fermi",
                              xpus="2",
                              xpu_model="Tesla 2050",
                              net_arch="ethernet",
                              net_mbps="10000")
     db.flavor_extra_specs_update_or_create(
                           self.context,
                           self.flavorid,
                           dict(net_arch="ethernet",
                                net_mbps=10000))
     actual_specs = db.flavor_extra_specs_get(
                           self.context,
                           self.flavorid)
     self.assertEquals(expected_specs, actual_specs)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:17,代码来源:test_instance_types_extra_specs.py


示例11: _get_extra_specs

 def _get_extra_specs(self, context, flavor_id):
     extra_specs = db.flavor_extra_specs_get(context, flavor_id)
     return dict(extra_specs=extra_specs)
开发者ID:Charu-Sharma,项目名称:nova,代码行数:3,代码来源:flavorextraspecs.py


示例12: _test_extra_specs_empty

 def _test_extra_specs_empty(self):
     empty_specs = {}
     actual_specs = db.flavor_extra_specs_get(
                           context.get_admin_context(),
                           self.instance_type_id)
     self.assertEquals(empty_specs, actual_specs)
开发者ID:iBeacons,项目名称:nova,代码行数:6,代码来源:test_nova_manage.py


示例13: test_instance_type_specs_get

 def test_instance_type_specs_get(self):
     actual_specs = db.flavor_extra_specs_get(
                           self.context,
                           self.flavorid)
     self.assertEqual(self.specs, actual_specs)
开发者ID:dlq84,项目名称:nova,代码行数:5,代码来源:test_instance_types_extra_specs.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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