本文整理汇总了Python中plumbery.nodes.PlumberyNodes._configure_backup方法的典型用法代码示例。如果您正苦于以下问题:Python PlumberyNodes._configure_backup方法的具体用法?Python PlumberyNodes._configure_backup怎么用?Python PlumberyNodes._configure_backup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plumbery.nodes.PlumberyNodes
的用法示例。
在下文中一共展示了PlumberyNodes._configure_backup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ConfigurePolisher
# 需要导入模块: from plumbery.nodes import PlumberyNodes [as 别名]
# 或者: from plumbery.nodes.PlumberyNodes import _configure_backup [as 别名]
#.........这里部分代码省略.........
continue
logging.info("- unable to add disk {} GB '{}'"
.format(size, speed))
logging.error(str(feedback))
break
def shine_node(self, node, settings, container):
"""
Finalizes setup of one node
:param node: the node to be polished
:type node: :class:`libcloud.compute.base.Node`
:param settings: the fittings plan for this node
:type settings: ``dict``
:param container: the container of this node
:type container: :class:`plumbery.PlumberyInfrastructure`
"""
logging.info("Configuring node '{}'".format(settings['name']))
if node is None:
logging.info("- not found")
return
cpu = None
if 'cpu' in settings:
tokens = str(settings['cpu']).split(' ')
if len(tokens) < 2:
tokens.append('1')
if len(tokens) < 3:
tokens.append('standard')
if (int(tokens[0]) < 1
or int(tokens[0]) > 32):
logging.info("- cpu should be between 1 and 32")
elif (int(tokens[1]) < 1
or int(tokens[1]) > 2):
logging.info("- core per cpu should be either 1 or 2")
elif tokens[2].upper() not in ('STANDARD',
'HIGHPERFORMANCE'):
logging.info("- cpu speed should be either 'standard'"
" or 'highspeed'")
else:
logging.debug("- setting compute {}".format(' '.join(tokens)))
cpu = DimensionDataServerCpuSpecification(
cpu_count=tokens[0],
cores_per_socket=tokens[1],
performance=tokens[2].upper())
memory = None
if 'memory' in settings:
memory = int(settings['memory'])
if memory < 1 or memory > 256:
logging.info("- memory should be between 1 and 256")
memory = None
else:
logging.debug("- setting {} GB of memory".format(
memory))
self.set_node_compute(node, cpu, memory)
if 'disks' in settings:
for item in settings['disks']:
logging.debug("- setting disk {}".format(item))
attributes = item.split()
if len(attributes) < 2:
logging.info("- malformed disk attributes;"
" provide disk id and size in GB, e.g., 1 50;"
" add disk type if needed, e.g., economy")
elif len(attributes) < 3:
id = int(attributes[0])
size = int(attributes[1])
speed = 'standard'
else:
id = int(attributes[0])
size = int(attributes[1])
speed = attributes[2]
self.set_node_disk(node, id, size, speed)
if 'monitoring' in settings:
self.nodes._start_monitoring(node, settings['monitoring'])
if 'backup' in settings:
self.nodes._configure_backup(node, settings['backup'])
if 'glue' in settings:
container._attach_node(node, settings['glue'])
container._add_to_pool(node)