本文整理汇总了Python中nailgun.extensions.volume_manager.extension.VolumeManagerExtension.set_volumes方法的典型用法代码示例。如果您正苦于以下问题:Python VolumeManagerExtension.set_volumes方法的具体用法?Python VolumeManagerExtension.set_volumes怎么用?Python VolumeManagerExtension.set_volumes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.extensions.volume_manager.extension.VolumeManagerExtension
的用法示例。
在下文中一共展示了VolumeManagerExtension.set_volumes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_volumes
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import set_volumes [as 别名]
def update_volumes(cls, instance):
"""Update volumes for Node instance.
Adds pending "disks" changes for Cluster which Node belongs to
:param instance: Node instance
:returns: None
"""
attrs = instance.attributes
if not attrs:
attrs = cls.create_attributes(instance)
try:
# TODO(eli): update volumes method should be moved
# into an extension
# Should be done as a part of blueprint:
# https://blueprints.launchpad.net/fuel/+spec
# /volume-manager-refactoring
from nailgun.extensions.volume_manager.extension \
import VolumeManagerExtension
VolumeManagerExtension.set_volumes(
instance,
instance.volume_manager.gen_volumes_info())
except Exception as exc:
msg = (
u"Failed to generate volumes "
u"info for node '{0}': '{1}'"
).format(
instance.name or instance.mac or instance.id,
str(exc) or "see logs for details"
)
logger.warning(traceback.format_exc())
Notification.create({
"topic": "error",
"message": msg,
"node_id": instance.id
})
if instance.cluster_id:
Cluster.add_pending_changes(
instance.cluster,
"disks",
node_id=instance.id
)
db().add(attrs)
db().flush()