maasserver.models.node

Node objects.

Functions

SET_DEFAULT(collector, field, sub_objs, using)
generate_hostname(size) Generate a hostname using only non-ambiguous characters.
generate_node_system_id()
get_db_state(instance, field_name) Get the persisted state of a given field for a given model instance.
get_object_or_404(klass, *args, **kwargs) Uses get() to return an object, or raises a Http404 exception if the object does not exist.
patch_pgarray_types() Monkey-patch incompatibility with recent versions of djorm_pgarray.
strip_domain(hostname) Return hostname with the domain part removed.
uuid1([node, clock_seq]) Generate a UUID from a host ID, sequence number, and the current time.
validate_hostname(hostname) Validator for hostnames.

Classes

BooleanField(*args, **kwargs)
CharField(*args, **kwargs)
CleanSave Mixin for model classes.
Config(*args, **kwargs) Configuration settings item.
DHCPLease(*args, **kwargs) A known mapping of an IP address to a MAC address.
DISTRO_SERIES List of supported ubuntu releases.
DefaultMeta Base class for model Meta classes in the maasserver app.
ForeignKey(to[, to_field, rel_class, ...])
IntegerField([verbose_name, name, ...])
JSONObjectField([verbose_name, name, ...]) A field that will store any jsonizable python object.
MAC(value) A MAC address represented as a database value.
Manager()
ManyToManyField(to[, db_constraint])
NODE_PERMISSION Permissions relating to nodes.
NODE_STATUS The vocabulary of a Node‘s possible statuses.
Node(*args, **kwargs) A Node represents a physical machine used by the MAAS Server.
NodeManager() A utility to manage the collection of Nodes.
Q(*args, **kwargs) Encapsulates filters as objects that can then be combined logically (using & and |).
Tag(*args, **kwargs) A Tag is a label applied to a Node.
TimestampedModel(*args, **kwargs) Abstract base model with creation/update timestamps.
Token(*args, **kwargs) Token(id, key, secret, verifier, token_type, timestamp, is_approved, user_id, consumer_id, callback, callback_confirmed)
User(*args, **kwargs) Users within the Django authentication system are represented by this model.
Zone(*args, **kwargs) A Zone is an entity used to logically group nodes together.
imap imap(func, *iterables) –> imap object
islice islice(iterable, [start,] stop [, step]) –> islice object
repeat repeat(object [,times]) -> create an iterator which returns the object

Exceptions

NodeStateViolation Operation on node not possible given node’s current state.
PermissionDenied The user did not have permission to do that
UnknownPowerType Raised when a node has an unknown power type.
ValidationError(message[, code, params]) An error while validating data.
class maasserver.models.node.Node(*args, **kwargs)[source]

Bases: maasserver.models.cleansave.CleanSave, maasserver.models.timestampedmodel.TimestampedModel

A Node represents a physical machine used by the MAAS Server.

Variables:
  • system_id – The unique identifier for this Node. (e.g. ‘node-41eba45e-4cfa-11e1-a052-00225f89f211’).
  • hostname – This Node‘s hostname. Must conform to RFCs 952 and 1123.
  • status – This Node‘s status. See the vocabulary NODE_STATUS.
  • owner – This Node‘s owner if it’s in use, None otherwise.
  • osystem – This Node‘s booting operating system, if it’s blank then the default_osystem will be used.
  • distro_series – This Node‘s booting distro series, if it’s blank then the default_distro_series will be used.
  • power_type – The power type that determines how this node will be powered on. Its value must match a power driver template name.
  • nodegroup – The NodeGroup this Node belongs to.
  • tags – The list of Tag`s associated with this `Node.
  • objects – The NodeManager.
fqdn[source]

Fully qualified domain name for this node.

If MAAS manages DNS for this node, the domain part of the hostname (if present), is replaced by the domain configured on the cluster controller. If not, simply return the node’s hostname.

ip_addresses()[source]

IP addresses allocated to this node.

clean_status()[source]

Check a node’s status transition against the node-status FSM.

display_status()[source]

Return status text as displayed to the user.

The UI representation is taken from NODE_STATUS_CHOICES_DICT and may interpolate the variable “owner” to reflect the username of the node’s current owner, if any.

add_mac_address(mac_address)[source]

Add a new MAC address to this Node.

Parameters:mac_address (unicode) – The MAC address to be added.
Raises:django.core.exceptions.ValidationError
remove_mac_address(mac_address)[source]

Remove a MAC address from this Node.

Parameters:mac_address (string) – The MAC address to be removed.
accept_enlistment(user)[source]

Accept this node’s (anonymous) enlistment.

This call makes sense only on a node in Declared state, i.e. one that has been anonymously enlisted and is now waiting for a MAAS user to accept that enlistment as authentic. Calling it on a node that is in Ready or Commissioning state, however, is not an error – it probably just means that somebody else has beaten you to it.

Returns:This node if it has made the transition from Declared, or None if it was already in an accepted state.
start_commissioning(user)[source]

Install OS and self-test a new node.

set_random_hostname()[source]

Set 5 character hostname using non-ambiguous characters.

Using 5 letters from the set ‘abcdefghjkmnpqrtwxy346789’ we get 9,765,625 combinations (pow(25, 5)).

Note that having a hostname starting with a number is perfectly valid, see http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names

get_effective_power_type()[source]

Get power-type to use for this node.

If no power type has been set for the node, raise UnknownPowerType.

get_primary_mac()[source]

Return the primary MACAddress for this node.

get_effective_kernel_options()[source]

Determine any special kernel parameters for this node.

Returns:(tag, kernel_options) tag is a Tag object or None. If None, the kernel_options came from the global setting. kernel_options, a string indicating extra kernel_options that should be used when booting this node. May be None if no tags match and no global setting has been configured.
work_queue[source]

The name of the queue for tasks specific to this node.

get_distro_series()[source]

Return the distro series to install that node.

set_distro_series(series=u'')[source]

Set the distro series to install that node.

get_effective_power_parameters()[source]

Return effective power parameters, including any defaults.

acquire(user, token=None, agent_name=u'')[source]

Mark commissioned node as acquired by the given user and token.

release()[source]

Mark allocated or reserved node as available again and power off.

set_netboot(on=True)[source]

Set netboot on or off.

should_use_traditional_installer()[source]

Should this node be installed with the traditional installer?

By default, nodes should be installed with the traditional installer, so this returns True when no use-fastpath-installer tag has been defined.

should_use_fastpath_installer()[source]

Should this node be installed with the Fast Path installer?

By default, nodes should be installed with the traditional installer, so this returns True when the use-fastpath-installer has been defined and False when it hasn’t.

use_traditional_installer()[source]

Set this node to be installed with the traditional installer.

By default, nodes should be installed with the Traditional installer.

Raises:RuntimeError when the use-traditional-installer tag is defined with an expression. The reason is that the tag evaluation machinery will eventually ignore whatever changes you make with this method.
use_fastpath_installer()[source]

Set this node to be installed with the Fast Path Installer.

By default, nodes should be installed with the Traditional Installer.

Raises:RuntimeError when the use-fastpath-installer tag is defined with an expression. The reason is that the tag evaluation machinery will eventually ignore whatever changes you make with this method.
split_arch()[source]

Return architecture and subarchitecture, as a tuple.

MAAS logo

MAAS

Metal As A Service.



Related Topics

This Page