本文整理匯總了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)