本文整理汇总了Python中nova.db.flavor_get_all函数的典型用法代码示例。如果您正苦于以下问题:Python flavor_get_all函数的具体用法?Python flavor_get_all怎么用?Python flavor_get_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flavor_get_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_migration
def test_migration(self):
main_flavors = len(db.flavor_get_all(self.context))
match, done = flavor_obj.migrate_flavors(self.context, 50)
self.assertEqual(main_flavors, match)
self.assertEqual(main_flavors, done)
self.assertEqual(0, len(db.flavor_get_all(self.context)))
self.assertEqual(main_flavors,
len(objects.FlavorList.get_all(self.context)))
开发者ID:BeyondTheClouds,项目名称:nova,代码行数:8,代码来源:test_flavor.py
示例2: test_rxtx_factor_must_be_within_sql_float_range
def test_rxtx_factor_must_be_within_sql_float_range(self):
_context = context.get_admin_context()
db.flavor_get_all(_context)
# We do * 10 since this is an approximation and we need to make sure
# the difference is noticeble.
over_rxtx_factor = flavors.SQL_SP_FLOAT_MAX * 10
self.assertInvalidInput("flavor1", 64, 1, 120, rxtx_factor=over_rxtx_factor)
flavor = flavors.create("flavor2", 64, 1, 120, rxtx_factor=flavors.SQL_SP_FLOAT_MAX)
self.assertEqual(flavors.SQL_SP_FLOAT_MAX, flavor.rxtx_factor)
开发者ID:isyippee,项目名称:nova,代码行数:11,代码来源:test_flavors.py
示例3: test_migration
def test_migration(self):
# create a flavor in the main database that will be migrated
_create_main_flavor(self.context)
main_flavors = len(db.flavor_get_all(self.context))
self.assertEqual(1, main_flavors)
match, done = flavor_obj.migrate_flavors(self.context, 50)
self.assertEqual(main_flavors, match)
self.assertEqual(main_flavors, done)
self.assertEqual(0, len(db.flavor_get_all(self.context)))
self.assertEqual(main_flavors,
len(objects.FlavorList.get_all(self.context)))
开发者ID:Juniper,项目名称:nova,代码行数:11,代码来源:test_flavor.py
示例4: get_all
def get_all(cls, context, inactive=False, filters=None,
sort_key='flavorid', sort_dir='asc', limit=None, marker=None):
try:
api_db_flavors = _flavor_get_all_from_db(context,
inactive=inactive,
filters=filters,
sort_key=sort_key,
sort_dir=sort_dir,
limit=limit,
marker=marker)
# NOTE(danms): If we were asked for a marker and found it in
# results from the API DB, we must continue our pagination with
# just the limit (if any) to the main DB.
marker = None
except exception.MarkerNotFound:
api_db_flavors = []
if limit is not None:
limit_more = limit - len(api_db_flavors)
else:
limit_more = None
if limit_more is None or limit_more > 0:
db_flavors = db.flavor_get_all(context, inactive=inactive,
filters=filters, sort_key=sort_key,
sort_dir=sort_dir, limit=limit_more,
marker=marker)
else:
db_flavors = []
return base.obj_make_list(context, cls(context), objects.Flavor,
api_db_flavors + db_flavors,
expected_attrs=['extra_specs'])
开发者ID:sapcc,项目名称:nova,代码行数:32,代码来源:flavor.py
示例5: get_all
def get_all(cls, context, inactive=False, filters=None,
sort_key='flavorid', sort_dir='asc', limit=None, marker=None):
db_flavors = db.flavor_get_all(context, inactive=inactive,
filters=filters, sort_key=sort_key,
sort_dir=sort_dir, limit=limit,
marker=marker)
return base.obj_make_list(context, cls(), Flavor, db_flavors,
expected_attrs=['extra_specs'])
开发者ID:B-Rich,项目名称:nova-1,代码行数:8,代码来源:flavor.py
示例6: test_instance_type_get_all
def test_instance_type_get_all(self):
types = db.flavor_get_all(self.context)
name2specs = {}
for instance_type in types:
name = instance_type['name']
name2specs[name] = instance_type['extra_specs']
self.assertEqual(name2specs['cg1.4xlarge'], self.specs)
self.assertEqual(name2specs['m1.small'], {})
开发者ID:dlq84,项目名称:nova,代码行数:10,代码来源:test_instance_types_extra_specs.py
示例7: setUp
def setUp(self):
super(DisabledFlavorsWithRealDBTest, self).setUp()
self.controller = flavors.FlavorsController()
# Add a new disabled type to the list of flavors
self.req = fakes.HTTPRequestV3.blank('/flavors')
self.context = self.req.environ['nova.context']
self.admin_context = context.get_admin_context()
self.disabled_type = self._create_disabled_instance_type()
self.inst_types = db.flavor_get_all(self.admin_context)
开发者ID:B-Rich,项目名称:nova-1,代码行数:11,代码来源:test_flavors.py
示例8: setUp
def setUp(self):
super(DisabledFlavorsWithRealDBTestV21, self).setUp()
# Add a new disabled type to the list of flavors
self.req = self.fake_request.blank(self._prefix + "/flavors")
self.context = self.req.environ["nova.context"]
self.admin_context = context.get_admin_context()
self.disabled_type = self._create_disabled_instance_type()
self.inst_types = db.flavor_get_all(self.admin_context)
self.controller = self.Controller()
开发者ID:j-carpentier,项目名称:nova,代码行数:11,代码来源:test_flavors.py
示例9: get_all_flavors_sorted_list
def get_all_flavors_sorted_list(
ctxt=None, inactive=False, filters=None, sort_key="flavorid", sort_dir="asc", limit=None, marker=None
):
"""Get all non-deleted flavors as a sorted list.
Pass true as argument if you want deleted flavors returned also.
"""
if ctxt is None:
ctxt = context.get_admin_context()
return db.flavor_get_all(ctxt, filters=filters, sort_key=sort_key, sort_dir=sort_dir, limit=limit, marker=marker)
开发者ID:kobtea,项目名称:nova,代码行数:11,代码来源:flavors.py
示例10: _create_disabled_instance_type
def _create_disabled_instance_type(self):
inst_types = db.flavor_get_all(self.admin_context)
inst_type = inst_types[0]
del inst_type["id"]
inst_type["name"] += ".disabled"
inst_type["flavorid"] = six.text_type(max([int(flavor["flavorid"]) for flavor in inst_types]) + 1)
inst_type["disabled"] = True
disabled_type = db.flavor_create(self.admin_context, inst_type)
return disabled_type
开发者ID:j-carpentier,项目名称:nova,代码行数:13,代码来源:test_flavors.py
示例11: get_all
def get_all(
cls, context, inactive=False, filters=None, sort_key="flavorid", sort_dir="asc", limit=None, marker=None
):
db_flavors = db.flavor_get_all(
context,
inactive=inactive,
filters=filters,
sort_key=sort_key,
sort_dir=sort_dir,
limit=limit,
marker=marker,
)
return base.obj_make_list(context, cls(context), objects.Flavor, db_flavors, expected_attrs=["extra_specs"])
开发者ID:gilmeir,项目名称:nova,代码行数:13,代码来源:flavor.py
示例12: get_all_flavors
def get_all_flavors(ctxt=None, inactive=False, filters=None):
"""Get all non-deleted flavors as a dict.
Pass true as argument if you want deleted flavors returned also.
"""
if ctxt is None:
ctxt = context.get_admin_context()
inst_types = db.flavor_get_all(ctxt, inactive=inactive, filters=filters)
inst_type_dict = {}
for inst_type in inst_types:
inst_type_dict[inst_type["name"]] = inst_type
return inst_type_dict
开发者ID:kobtea,项目名称:nova,代码行数:14,代码来源:flavors.py
示例13: _create_disabled_instance_type
def _create_disabled_instance_type(self):
inst_types = db.flavor_get_all(self.admin_context)
inst_type = inst_types[0]
del inst_type['id']
inst_type['name'] += '.disabled'
inst_type['flavorid'] = six.text_type(max(
[int(flavor['flavorid']) for flavor in inst_types]) + 1)
inst_type['disabled'] = True
disabled_type = db.flavor_create(
self.admin_context, inst_type)
return disabled_type
开发者ID:375670450,项目名称:nova,代码行数:15,代码来源:test_flavors.py
示例14: test_instance_type_get_all
def test_instance_type_get_all(self):
specs = dict(cpu_arch="x86_64",
cpu_model="Nehalem",
xpu_arch="fermi",
xpus='2',
xpu_model="Tesla 2050")
types = db.flavor_get_all(self.context)
name2specs = {}
for instance_type in types:
name = instance_type['name']
name2specs[name] = instance_type['extra_specs']
self.assertEquals(name2specs['cg1.4xlarge'], specs)
self.assertEquals(name2specs['m1.small'], {})
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:16,代码来源:test_instance_types_extra_specs.py
示例15: assertFilterResults
def assertFilterResults(self, filters, expected):
inst_types = db.flavor_get_all(
self.context, filters=filters)
inst_names = [i['name'] for i in inst_types]
self.assertEqual(inst_names, expected)
开发者ID:Charu-Sharma,项目名称:nova,代码行数:5,代码来源:test_flavors.py
注:本文中的nova.db.flavor_get_all函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论