metalsmith.Instance(connection, node)¶Bases: object
Instance status in metalsmith.
hostname¶Node’s hostname.
ip_addresses()¶Returns IP addresses for this instance.
| Returns: | dict mapping network name or ID to a list of IP addresses. |
|---|
is_deployed¶Whether the node is deployed.
is_healthy¶Whether the instance is not at fault or maintenance.
nics()¶List NICs for this instance.
| Returns: | List of Port objects with additional network fields
with full representations of their networks. |
|---|
node¶Underlying Node object.
state¶Instance state, one of InstanceState.
to_dict()¶Convert instance to a dict.
uuid¶Instance UUID (the same as Node UUID for metalsmith).
metalsmith.InstanceConfig(ssh_keys=None)¶Bases: object
Configuration of the target instance.
The information attached to this object will be passed via a configdrive to the instance’s first boot script (e.g. cloud-init).
| Variables: |
|
|---|
add_user(name, admin=True, password_hash=None, sudo=False, **kwargs)¶Add a user to be created on first boot.
| Parameters: |
|
|---|
build_configdrive(node, hostname)¶Make the config drive.
| Parameters: |
|
|---|---|
| Returns: | configdrive contents as a base64-encoded string. |
metalsmith.InstanceState¶Bases: enum.Enum
A state of an instance.
ACTIVE = 'active'¶The instance is provisioned.
DEPLOYING = 'deploying'¶Provisioning is in progress.
This includes the case when a node is still in the available state, but
already has an instance associated with it.
ERROR = 'error'¶The instance has a failure.
MAINTENANCE = 'maintenance'¶The instance is provisioned but is in the maintenance mode.
UNKNOWN = 'unknown'¶The node is in an unexpected state.
It can be unprovisioned or modified by a third party.
is_deployed¶Whether the state designates a finished deployment.
is_healthy¶Whether the state is considered healthy.
metalsmith.Provisioner(session=None, cloud_region=None, dry_run=False)¶Bases: metalsmith._utils.GetNodeMixin
API to deploy/undeploy nodes with OpenStack.
| Parameters: |
|
|---|---|
| Variables: | connection – openstacksdk Connection object used for accessing OpenStack API during provisioning. |
list_instances()¶List instances deployed by metalsmith.
| Returns: | list of metalsmith.Instance objects. |
|---|
provision_node(node, image, nics=None, root_size_gb=None, swap_size_mb=None, config=None, hostname=None, netboot=False, capabilities=None, traits=None, wait=None)¶Provision the node with the given image.
Example:
provisioner.provision_node("compute-1", "centos",
nics=[{"network": "private"},
{"network": "external"}],
root_size_gb=50,
wait=3600)
| Parameters: |
|
|---|---|
| Returns: |
|
| Raises: |
reserve_node(resource_class=None, conductor_group=None, capabilities=None, traits=None, candidates=None, predicate=None)¶Find and reserve a suitable node.
Example:
node = provisioner.reserve_node("compute",
capabilities={"boot_mode": "uefi"})
| Parameters: |
|
|---|---|
| Returns: | reserved Node object. |
| Raises: |
show_instance(instance_id)¶Show information about instance.
| Parameters: | instance_id – hostname, UUID or node name. |
|---|---|
| Returns: | metalsmith.Instance object. |
| Raises: | metalsmith.exceptions.InvalidInstance
if the instance is not a valid instance. |
show_instances(instances)¶Show information about instance.
More efficient than calling show_instance() in a loop, because
it caches the node list.
| Parameters: | instances – list of hostnames, UUIDs or node names. |
|---|---|
| Returns: | list of metalsmith.Instance objects in the same
order as instances. |
| Raises: | metalsmith.exceptions.InvalidInstance
if one of the instances are not valid instances. |
unprovision_node(node, wait=None)¶Unprovision a previously provisioned node.
| Parameters: |
|
|---|---|
| Returns: | the latest Node object. |
wait_for_provisioning(nodes, timeout=None, delay=None)¶Wait for nodes to be provisioned.
Loops until all nodes finish provisioning.
| Parameters: |
|
|---|---|
| Returns: | List of updated |
| Raises: |
|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.