本文整理汇总了Python中nova.db.flavor_destroy函数的典型用法代码示例。如果您正苦于以下问题:Python flavor_destroy函数的具体用法?Python flavor_destroy怎么用?Python flavor_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flavor_destroy函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: migrate_flavors
def migrate_flavors(ctxt, count, hard_delete=False):
main_db_ids = _get_main_db_flavor_ids(ctxt, count)
if not main_db_ids:
return 0, 0
count_all = len(main_db_ids)
count_hit = 0
for flavor_id in main_db_ids:
try:
flavor = Flavor.get_by_id(ctxt, flavor_id)
flavor_values = {field: getattr(flavor, field)
for field in flavor.fields}
flavor._flavor_create(ctxt, flavor_values)
count_hit += 1
if hard_delete:
_destroy_flavor_hard(ctxt, flavor.name)
else:
db.flavor_destroy(ctxt, flavor.flavorid)
except exception.FlavorNotFound:
LOG.warning('Flavor id %(id)i disappeared during migration',
{'id': flavor_id})
except (exception.FlavorExists, exception.FlavorIdExists) as e:
LOG.error(six.text_type(e))
return count_all, count_hit
开发者ID:sapcc,项目名称:nova,代码行数:26,代码来源:flavor.py
示例2: destroy
def destroy(name):
"""Marks flavor as deleted."""
try:
assert name is not None
db.flavor_destroy(context.get_admin_context(), name)
except (AssertionError, exception.NotFound):
LOG.exception(_('Instance type %s not found for deletion') % name)
raise exception.InstanceTypeNotFoundByName(instance_type_name=name)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:8,代码来源:flavors.py
示例3: destroy
def destroy(name):
"""Marks flavor as deleted."""
try:
if not name:
raise ValueError()
db.flavor_destroy(context.get_admin_context(), name)
except (ValueError, exception.NotFound):
LOG.exception(_('Instance type %s not found for deletion') % name)
raise exception.FlavorNotFoundByName(flavor_name=name)
开发者ID:B-Rich,项目名称:nova-1,代码行数:9,代码来源:flavors.py
示例4: destroy
def destroy(self):
# NOTE(danms): Historically the only way to delete a flavor
# is via name, which is not very precise. We need to be able to
# support the light construction of a flavor object and subsequent
# delete request with only our name filled out. However, if we have
# our id property, we should instead delete with that since it's
# far more specific.
try:
if 'id' in self:
self._flavor_destroy(self._context, flavor_id=self.id)
else:
self._flavor_destroy(self._context, name=self.name)
except exception.FlavorNotFound:
db.flavor_destroy(self._context, self.name)
开发者ID:BU-NU-CLOUD-SP16,项目名称:Trusted-Platform-Module-nova,代码行数:14,代码来源:flavor.py
示例5: tearDown
def tearDown(self):
db.flavor_destroy(
self.admin_context, self.disabled_type['name'])
super(DisabledFlavorsWithRealDBTestV21, self).tearDown()
开发者ID:375670450,项目名称:nova,代码行数:5,代码来源:test_flavors.py
示例6: tearDown
def tearDown(self):
db.flavor_destroy(context.get_admin_context(),
"test.small")
super(InstanceTypeCommandsTestCase, self).tearDown()
开发者ID:iBeacons,项目名称:nova,代码行数:4,代码来源:test_nova_manage.py
示例7: destroy
def destroy(self, context):
db.flavor_destroy(context, self.name)
开发者ID:B-Rich,项目名称:nova-1,代码行数:2,代码来源:flavor.py
示例8: destroy
def destroy(self):
db.flavor_destroy(self._context, self.name)
开发者ID:darren-wang,项目名称:nv,代码行数:2,代码来源:flavor.py
示例9: tearDown
def tearDown(self):
# Remove the instance type from the database
db.flavor_destroy(self.context, "cg1.4xlarge")
super(InstanceTypeExtraSpecsTestCase, self).tearDown()
开发者ID:dlq84,项目名称:nova,代码行数:4,代码来源:test_instance_types_extra_specs.py
注:本文中的nova.db.flavor_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论