本文整理汇总了Python中cattle.Config.volmgr_default_volume_size方法的典型用法代码示例。如果您正苦于以下问题:Python Config.volmgr_default_volume_size方法的具体用法?Python Config.volmgr_default_volume_size怎么用?Python Config.volmgr_default_volume_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cattle.Config
的用法示例。
在下文中一共展示了Config.volmgr_default_volume_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_managed_volume
# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import volmgr_default_volume_size [as 别名]
def update_managed_volume(instance, config, start_config):
if not enabled():
return
if 'binds' not in start_config:
return
binds_map = start_config['binds']
instance_name = config['name']
new_binds_map = {}
user = "default"
if 'user' in config and config['user'] is not None:
user = config['user']
for bind in binds_map:
src = bind
dst = binds_map[bind]
if src.startswith(RANCHER_PREFIX):
vol_command = src[len(RANCHER_PREFIX):]
words = vol_command.split("/")
vol_name = words[0]
command = ""
old_volume_uuid = ""
snapshot_uuid = ""
if len(words) > 1:
command = words[1]
if command == "restore":
assert len(words) == 4
old_volume_uuid = words[2]
snapshot_uuid = words[3]
else:
log.error("unsupported command %s, \
ignore and create volume", command)
if command == "restore":
log.info("About to restore snapshot")
mount_point = _restore_snapshot(
vol_name, old_volume_uuid,
Config.volmgr_default_volume_size(), snapshot_uuid,
instance_name, user)
new_binds_map[mount_point] = dst
else:
mount_point = _get_volume(vol_name,
Config.volmgr_default_volume_size(),
instance_name, user)
new_binds_map[mount_point] = dst
else:
new_binds_map[src] = binds_map[src]
start_config['binds'] = new_binds_map