maasserver.models

Model export and helpers for maasserver.

Functions

create_user(sender, instance, created, **kwargs)
get_callable(*args) Convert a string version of a function name to the callable object.
get_resolver(*args)
get_resource_uri_template(self) URI template processor.
get_script_prefix() Returns the currently active script prefix.
ignore_unused(*args) Suppress warnings about unused variables.

Classes

BootResource(*args, **kwargs) Boot resource.
BootResourceFile(*args, **kwargs) File associated with a BootResourceSet.
BootResourceSet(*args, **kwargs) Set of files that make up a BootResource.
BootSource(*args, **kwargs) A source for boot resources.
BootSourceCache(*args, **kwargs) A cache of an image provided in boot source.
BootSourceSelection(*args, **kwargs) A set of selections for a single BootSource.
CandidateName(*args, **kwargs) A CandidateName represents a name we can use to name something.
ComponentError(*args, **kwargs) Error state of a major component of the system.
Config(*args, **kwargs) Configuration settings item.
DHCPLease(*args, **kwargs) A known mapping of an IP address to a MAC address.
DownloadProgress(*args, **kwargs) Progress report from a cluster for one of its boot-image downloads.
Event(*args, **kwargs) An Event represents a MAAS event.
EventType(*args, **kwargs) A type for events.
FileStorage(*args, **kwargs) A simple file storage keyed on file name.
HandlerDocumentation(handler)
LargeFile(*args, **kwargs) Files that are stored in the large object storage.
LicenseKey(*args, **kwargs) Available license key for osystem and distro_series combo.
MAASAuthorizationBackend
MACAddress(*args, **kwargs) A MACAddress represents a MAC address attached to a Node.
MACStaticIPAddressLink(*args, **kwargs) MACStaticIPAddressLink(id, created, updated, mac_address_id, ip_address_id, nic_alias)
ModelBackend Authenticates against settings.AUTH_USER_MODEL.
NODE_PERMISSION Permissions relating to nodes.
Network(*args, **kwargs) Network(id, name, ip, netmask, default_gateway, dns_servers, vlan_tag, description)
Node(*args, **kwargs) A Node represents a physical machine used by the MAAS Server.
NodeGroup(*args, **kwargs) NodeGroup(id, created, updated, cluster_name, name, status, api_token_id, api_key, dhcp_key, uuid, maas_url, default_disable_ipv4)
NodeGroupInterface(*args, **kwargs) Cluster interface.
SSHKey(*args, **kwargs) An SSHKey represents a user public SSH key.
SSLKey(*args, **kwargs) An SSLKey represents a user SSL key.
StaticIPAddress(*args, **kwargs) StaticIPAddress(id, created, updated, ip, alloc_type, user_id)
Tag(*args, **kwargs) A Tag is a label applied to a Node.
User(*args, **kwargs) Users within the Django authentication system are represented by this model.
UserProfile(*args, **kwargs) A User profile to store MAAS specific methods and fields.
Zone(*args, **kwargs) A Zone is an entity used to logically group nodes together.
class maasserver.models.BootResource(*args, **kwargs)

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

Boot resource.

Each BootResource represents a os/series combination or custom uploaded image that maps to a specific architecture that a node can use to commission or install.

BootResource can have multiple BootResourceSet corresponding to different versions of this BootResource. When a node selects this BootResource the newest BootResourceSet is used to deploy to the node.

Variables:
  • rtype – Type of BootResource. See the vocabulary BOOT_RESOURCE_TYPE.
  • name – Name of the BootResource. If its BOOT_RESOURCE_TYPE.UPLOADED then name is used to reference this image. If its BOOT_RESOURCE_TYPE.SYCNED or BOOT_RESOURCE_TYPE.GENERATED then its in the format of os/series.
  • architecture – Architecture of the BootResource. It must be in the format arch/subarch.
  • extra – Extra information about the file. This is only used for synced Ubuntu images.
clean()

Validate the model.

Checks that the name is in a valid format, for its type.

display_rtype

Return rtype text as displayed to the user.

get_latest_complete_set()

Return latest BootResourceSet where all BootResouceFile‘s are complete.

get_latest_set()

Return latest BootResourceSet.

get_next_version_name()

Return the version a BootResourceSet should use when adding to this resource.

The version naming is specific to how the resource sets will be sorted by simplestreams. The version name is YYYYmmdd, with an optional revision index. (e.g. 20140822.1)

This method gets the current date, and checks if a revision already exists in the database. If it doesn’t then just the current date is returned. If it does exists then the next revision in the set for that date will be returned.

Returns:Name of version to use for a new set on this BootResource.
Return type:string
supports_subarch(subarch)

Return True if the resource supports the given subarch.

class maasserver.models.BootResourceFile(*args, **kwargs)

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

File associated with a BootResourceSet.

Each BootResourceSet contains a set of files. For user uploaded boot resources this is only one file. For synced and generated resources this can be multiple files.

Variables:
  • resource_setBootResourceSet file belongs to. When BootResourceSet is deleted, this BootResourceFile will be deleted.
  • largefile – Actual file information and data. See LargeFile.
  • filename – Name of the file.
  • filetype – Type of the file. See the vocabulary BOOT_RESOURCE_FILE_TYPE.
  • extra – Extra information about the file. This is only used for synced Ubuntu images.
class maasserver.models.BootResourceSet(*args, **kwargs)

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

Set of files that make up a BootResource. Each BootResource can have a different set of files. As new versions of the BootResource is synced, generated, or uploaded then new sets are created.

A booting node will always select the newest BootResourceSet for the selected BootResource. Older booted nodes might be using past versions. Older BootResourceSet are removed once zero nodes are referencing them.

Each BootResourceSet contains a set of files. For user uploaded boot resources this is only one file. For synced and generated resources this can be multiple files.

Variables:
  • resourceBootResource set belongs to. When BootResource is deleted, this BootResourceSet will be deleted. Along with all associated files.
  • version – Version name for the set. This normally is in the format of YYYYmmdd.r.
  • label – Label for this version. For GENERATED and UPLOADED its always generated or uploaded respectively. For SYNCED its depends on the source, either daily or release.
commissionable

True if BootResourceSet supports the ability to commission a node.

complete

True if all files in the set are complete.

installable

True if BootResourceSet supports the ability to install to a node.

progress

Percentage complete for all files in the set.

size

Amount of space this set currently consumes.

total_size

Total amount of space this set will consume.

xinstallable

True if BootResourceSet supports the ability to xinstall to a node.

class maasserver.models.BootSource(*args, **kwargs)

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

A source for boot resources.

to_dict()

Return the current BootSource as a dict.

The dict will contain the details of the BootSource and all its BootSourceSelection items.

If the BootSource has keyring_data, that data will be returned base64 encoded. Otherwise the BootSource will have a value in its keyring_filename field, and that file’s contents will be base64 encoded and returned.

to_dict_without_selections()

Return the current BootSource as a dict, without including any BootSourceSelection items.

The dict will contain the details of the BootSource.

If the BootSource has keyring_data, that data will be returned base64 encoded. Otherwise the BootSource will have a value in its keyring_filename field, and that file’s contents will be base64 encoded and returned.

class maasserver.models.BootSourceCache(*args, **kwargs)

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

A cache of an image provided in boot source.

class maasserver.models.BootSourceSelection(*args, **kwargs)

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

A set of selections for a single BootSource.

to_dict()

Return the current BootSourceSelection as a dict.

class maasserver.models.ComponentError(*args, **kwargs)

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

Error state of a major component of the system.

class maasserver.models.Config(*args, **kwargs)

Bases: django.db.models.base.Model

Configuration settings item.

Variables:
  • name – The name of the configuration option.
  • value – The configuration value.
class maasserver.models.DHCPLease(*args, **kwargs)

Bases: maasserver.models.cleansave.CleanSave, django.db.models.base.Model

A known mapping of an IP address to a MAC address.

These correspond to the latest-known DHCP leases handed out to nodes (or potential nodes – they may not have been enlisted yet!) by the node group worker’s DHCP server.

class maasserver.models.DownloadProgress(*args, **kwargs)

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

Progress report from a cluster for one of its boot-image downloads.

Each download on each cluster controller gets its own record. The bytes_downloaded and last-change timestamp are updated with each progress report for that download. The creation timestamp reflects the time of the download’s first progress report.

A cluster may download a file of the same name as a file it has downloaded once already. The new download will have a new record.

The download is complete when bytes_downloaded equals size, provided there is no error. A download with a non-blank error is considered to have failed.

Variables:
  • nodegroup – The cluster whose controller is doing this download.
  • filename – Name of the file being downloaded.
  • size – Size of the file, in bytes. This may not be known in advance, but must be set at some point for any successful download.
  • bytes_downloaded – Number of bytes that have been downloaded.
  • error – Failure message.
class maasserver.models.Event(*args, **kwargs)

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

An Event represents a MAAS event.

Variables:
  • type – The event’s type.
  • node – The node of the event.
  • description – A free-form description of the event.
class maasserver.models.FileStorage(*args, **kwargs)

Bases: maasserver.models.cleansave.CleanSave, django.db.models.base.Model

A simple file storage keyed on file name.

Variables:
  • filename – A file name to use for the data being stored.
  • owner – This file’s owner..
  • content – The file’s actual data.
anon_resource_uri

URI where the content of the file can be retrieved anonymously.

class maasserver.models.LargeFile(*args, **kwargs)

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

Files that are stored in the large object storage.

Only unique files are stored in the database, as only one sha256 value can exist per file. This provides data deduplication on the file level.

Currently only used by BootResourceFile. This speeds up the import process by only saving unique files.

Variables:
  • sha256 – Calculated SHA256 value of content.
  • total_size – Final size of content. The data might currently be saving, so total_size could be larger than size. size should never be larger than total_size.
  • content – File data.
complete

content has been completely saved.

delete(*args, **kwargs)

Delete this object.

Important: You must remove your reference to this object or it will not delete. Object will only be deleted if no other objects are referencing this object.

progress

Precentage of content saved.

size

Size of content.

valid

All content has been written and stored SHA256 value is the same as the calculated SHA256 value stored in the database.

Note: Depending on the size of the file, this can take some time.

class maasserver.models.LicenseKey(*args, **kwargs)

Bases: maasserver.models.timestampedmodel.TimestampedModel

Available license key for osystem and distro_series combo.

Each LicenseKey matches to a operating system and release. Only one license key can exists per osystem/distro_series combination.

class maasserver.models.MACAddress(*args, **kwargs)

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

A MACAddress represents a MAC address attached to a Node.

Variables:
  • mac_address – The MAC address.
  • node – The Node related to this MACAddress.
  • networks – The networks related to this MACAddress.
claim_static_ips(alloc_type=0, requested_address=None)

Assign static IP addresses to this MAC.

Allocates one address per managed cluster interface connected to this MAC. Typically this will be either just one IPv4 address, or an IPv4 address and an IPv6 address.

It is the caller’s responsibility to update the DHCP server.

Parameters:
  • alloc_type – See StaticIPAddress.alloc_type. This parameter musn’t be IPADDRESS_TYPE.USER_RESERVED.
  • requested_address – Optional IP address to claim. Must be in the range defined on some cluster interface to which this MACAddress is related. If given, no allocations will be made on any other cluster interfaces the MAC may be connected to.
Returns:

A list of StaticIPAddress. Returns empty if the cluster_interface is not yet known, or the static_ip_range_low/high values values are not set on the cluster_interface. If an IP address was already allocated, the function will return it rather than allocate a new one.

Raises:

StaticIPAddressExhaustion if there are not enough IPs left.

Raises:

StaticIPAddressTypeClash if an IP already exists with a different type.

Raises:

StaticIPAddressOutOfRange if the requested_address is not in the cluster interface’s defined range.

Raises:

StaticIPAddressUnavailable if the requested_address is already allocated.

get_cluster_interfaces()

Return all cluster interfaces to which this MAC connects.

This is at least its cluster_interface, if it is set. But if so, there may also be an IPv6 cluster interface attached to the same network interface.

get_networks()

Return networks to which this MAC is connected, sorted by name.

class maasserver.models.Network(*args, **kwargs)

Bases: maasserver.models.cleansave.CleanSave, django.db.models.base.Model

Network(id, name, ip, netmask, default_gateway, dns_servers, vlan_tag, description)

clean_netmask()

Validator for vlan_tag.

clean_vlan_tag()

Validator for vlan_tag.

get_connected_nodes()

Return the QuerySet of the nodes connected to this network.

Return type:django.db.models.query.QuerySet
get_network()

Return self as IPNetwork.

Raises AddrFormatError:
 If the combination of self.ip and self.netmask is a malformed network address.
class maasserver.models.Node(*args, **kwargs)

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.
  • error_description – A human-readable description of why a node is marked broken. Only meaningful when the node is in the state ‘BROKEN’.
  • owner – This Node‘s owner if it’s in use, None otherwise.
  • boot_type – This Node‘s booting method. See the vocabulary NODE_BOOT.
  • 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.
abort_commissioning(user)

Power off a commissioning node and set its status to ‘declared’.

abort_disk_erasing(user)

Power off disk erasing node and set its status to ‘failed disk erasing’.

abort_operation(user)

Abort the current operation. This currently only supports aborting Disk Erasing.

accept_enlistment(user)

Accept this node’s (anonymous) enlistment.

This call makes sense only on a node in New 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 New, or None if it was already in an accepted state.
acquire(user, token=None, agent_name=u'')

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

add_mac_address(mac_address)

Add a new MAC address to this Node.

Parameters:mac_address (unicode) – The MAC address to be added.
Raises:django.core.exceptions.ValidationError
claim_static_ip_addresses()

Assign static IPs to the node’s PXE MAC.

Returns:A list of (ip-address, mac-address) tuples.
Raises:StaticIPAddressExhaustion if there are not enough IPs left.
clean_status()

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

delete()

Delete this node.

delete_host_maps(for_ips)

Delete any host maps for IPs allocated to this node.

This should probably live on NodeGroup.

Parameters:for_ips (set) – The set of IP addresses to remove host maps for.
display_memory()

Return memory in GB.

display_status()

Return status text as displayed to the user.

display_storage()

Return storage in GB.

dynamic_ip_addresses()

Dynamic IP addresses allocated to this node.

end_deployment()

Mark a node as successfully deployed.

fqdn

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.

get_boot_purpose()

Return a suitable “purpose” for this boot, e.g. “install”.

get_commissioning_time()

Return the commissioning time of this node (in seconds).

This is the maximum time the commissioning is allowed to take.

get_deployment_status()

Return a string repr of the deployment status of this node.

get_deployment_time()

Return the deployment time of this node (in seconds).

This is the maximum time the deployment is allowed to take.

get_distro_series()

Return the distro series to install that node.

get_effective_kernel_options()

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.
get_effective_license_key()

Return effective license key.

This returns the license key that should be used during the installation of the operating system for this node. This method first checks to see if the node has a specific license key set, if not then the license key registry is checked, if neither exists for this node or the booting operating system and release combination then an empty string is returned. An empty string can mean two things, one the operating system does not require a license key, or the installation media already has the license key builtin.

get_effective_power_info()

Get information on how to control this node’s power.

Returns a (can-be-started, can-be-stopped, power-type, power-parameters) tuple, where can-be-started and can-be-stopped are hints, based on the power type and power parameters, whether it’s even worth trying to control this node’s power.

Put another way, if can-be-started is False, the node almost certainly cannot be started. If it’s True, then it may be possible to control this node’s power, but there are no guarantees. The same goes for can-be-stopped.

Returns:PowerInfo (a namedtuple)
get_effective_power_parameters()

Return effective power parameters, including any defaults.

get_effective_power_type()

Get power-type to use for this node.

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

get_osystem()

Return the operating system to install that node.

get_primary_mac()

Return the primary MACAddress for this node.

get_pxe_mac()

Get the MAC address this node is expected to PXE boot from.

Normally, this will be the MAC address last used in a pxeconfig() API request for the node, as recorded in the ‘pxe_mac’ property. However, if the node hasn’t PXE booted since the ‘pxe_mac’ property was added to the Node model, this will return the node’s first MAC address instead.

get_static_ip_mappings()

Return node’s static addresses, and their MAC addresses.

Returns:A list of (IP, MAC) tuples, both in string form.
handle_monitor_expired(context)

Handle a monitor expired event.

ip_addresses()

IP addresses allocated to this node.

Return the current IP addresses for this Node, or the empty list if there are none.

If disable_ipv4 is set, any IPv4 addresses will be omitted.

mac_addresses_on_managed_interfaces()

Return MACAddresses for this node that have a managed cluster interface.

mark_broken(error_description)

Mark this node as ‘BROKEN’.

If the node is allocated, release it first.

mark_failed(error_description)

Mark this node as failed.

The actual ‘failed’ state depends on the current status of the node.

mark_fixed()

Mark a broken node as fixed and change its state to ‘READY’.

release()

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

release_or_erase()

Either release the node or erase the node then release it, depending on settings.

remove_mac_address(mac_address)

Remove a MAC address from this Node.

Parameters:mac_address (string) – The MAC address to be removed.
set_netboot(on=True)

Set netboot on or off.

set_random_hostname()

Set hostname from a shuffled list of candidate names.

See gen_candidate_names.

http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names

split_arch()

Return architecture and subarchitecture, as a tuple.

start(by_user, user_data=None)

Request on given user’s behalf that the node be started up.

Parameters:
  • by_user (User) – Requesting user.
  • user_data (unicode) – Optional blob of user-data to be made available to the node through the metadata service. If not given, any previous user data is used.
Raises:

StaticIPAddressExhaustion if there are not enough IP addresses left in the static range for this node toget all the addresses it needs.

start_commissioning(user)

Install OS and self-test a new node.

start_deployment()

Mark a node as being deployed.

start_disk_erasing(user)

Erase the disks on a node.

start_transition_monitor(timeout)

Start cluster-side transition monitor.

static_ip_addresses()

Static IP addresses allocated to this node.

stop(by_user, stop_mode=u'hard')

Request that the node be powered down.

Parameters:
  • by_user (User) – Requesting user.
  • stop_mode (unicode) – Power off mode - usually ‘soft’ or ‘hard’.
Returns:

True if the power action was sent to the node; False if it wasn’t sent. If the user doesn’t have permission to stop the node, return None.

stop_transition_monitor()

Stop cluster-side transition monitor.

update_power_state(power_state)

Update a node’s power state

work_queue

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

class maasserver.models.NodeGroup(*args, **kwargs)

Bases: maasserver.models.timestampedmodel.TimestampedModel

NodeGroup(id, created, updated, cluster_name, name, status, api_token_id, api_key, dhcp_key, uuid, maas_url, default_disable_ipv4)

accept()

Accept this nodegroup’s enlistment.

add_seamicro15k(mac, username, password, power_control=None)

Add all of the specified cards the Seamicro SM15000 chassis at the specified MAC.

Parameters:
  • mac – MAC address of the card.
  • username – username for power controller
  • password – password for power controller
  • power_control – optional specify the power control method, either ipmi (default), restapi, or restapi2.
Raises NoConnectionsAvailable:
 

If no connections to the cluster are available.

add_virsh(poweraddr, password=None)

Add all of the virtual machines inside a virsh controller.

Parameters:
  • poweraddr – virsh connection string
  • password – ssh password
Raises NoConnectionsAvailable:
 

If no connections to the cluster are available.

api_credentials

Return a string containing credentials for this nodegroup.

enlist_nodes_from_mscm(host, username, password)

Add the servers from a Moonshot HP iLO Chassis Manager.

Parameters:
  • host – IP address for the MSCM.
  • username – username for MSCM.
  • password – password for MSCM.
Raises NoConnectionsAvailable:
 

If no connections to the cluster are available.

enlist_nodes_from_ucsm(url, username, password)

Add the servers from a Cicso UCS Manager.

Parameters:
  • URL – URL of the Cisco UCS Manager HTTP-XML API.
  • username – username for UCS Manager.
  • password – password for UCS Manager.
Raises NoConnectionsAvailable:
 

If no connections to the cluster are available.

ensure_dhcp_key()

Ensure that this nodegroup has a dhcp key.

This method persists the dhcp key without triggering the model signals (pre_save/post_save/etc) because it’s called from dhcp.configure_dhcp which, in turn, it called from the post_save signal of NodeGroup.

get_managed_interfaces()

Return the list of interfaces for which MAAS manages DHCP.

get_state()

Get the current state of the cluster.

This returns information about if the cluster is connected, out-of-sync, syncing, synced.

import_boot_images()

Import the pxe files on this cluster controller.

This will cause the cluster to connect to the region to download the images that are exposed there.

is_connected()

Is this cluster connected to his provisioning server?

manages_dns()

Does this NodeGroup manage DNS on any interfaces?

This returns True when the NodeGroup is accepted, and has a NodeGroupInterface that’s set to manage both DHCP and DNS.

reject()

Reject this nodegroup’s enlistment.

work_queue

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

class maasserver.models.NodeGroupInterface(*args, **kwargs)

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

Cluster interface.

Represents a network to which a given cluster controller is connected. These interfaces are discovered automatically, but an admin can also add/edit/remove them.

This class duplicates some of Network, and adds settings for managing DHCP. Some day we hope to delegate the duplicated fields, and have auto-discovery populate the Network model along the way.

check_for_network_interface_clashes(exclude)

Validate uniqueness rules for network interfaces.

This enforces the rules that there can be only one IPv4 cluster interface on a given network interface on the cluster controller, and that there can be only one IPv6 cluster interface with a static range on a given network interface on the cluster controller. Aliases and VLANs count as separate network interfaces.

The IPv4 rule is inherent: a network interface (as seen in userspace) can only be on one IPv4 subnet. The IPv6 rule is needed because our current way of configuring IPv6 addresses on nodes, in /etc/network, does not support multiple addresses. So a network interface on a node can only be on one IPv6 subnet. Since the node’s network interface is connected to the same network segment as the cluster controller’s, that means that the cluster controller can only manage static IP addresses on one IPv6 subnet per network interface.

clean_ip_range_bounds()

Ensure that the static and dynamic ranges have sane bounds.

clean_ip_ranges()

Ensure that the static and dynamic ranges don’t overlap.

clean_ips_in_network()

Ensure that the network settings are all congruent.

Specifically, it ensures that the router address, the DHCP address range, and the broadcast address if given, all fall within the network defined by the interface’s IP address and the subnet mask.

If no broadcast address is given, the network’s default broadcast address will be used.

clean_network_valid()

Validate the network.

This validates that the network defined by ip and subnet_mask is valid.

clean_overlapping_networks()

Ensure that this interface’s network doesn’t overlap those of other interfaces on this cluster.

display_management()

Return management status text as displayed to the user.

is_managed

Return true if this interface is managed by MAAS.

manages_static_range()

Is this a managed interface with a static IP range configured?

network

Return the network defined by the interface’s address and netmask.

Returns:IPNetwork, or None if the netmask is unset.
Raises AddrFormatError:
 If the combination of interface address and subnet mask is malformed.
validate_unique(exclude=None)

Validate against conflicting NodeGroupInterface objects.

class maasserver.models.SSHKey(*args, **kwargs)

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

An SSHKey represents a user public SSH key.

Users will be able to access allocated nodes using any of their registered keys.

Variables:
  • user – The user which owns the key.
  • key – The SSH public key.
display_html()

Return a compact HTML representation of this key.

Returns:The HTML representation of this key.
Return type:unicode
class maasserver.models.SSLKey(*args, **kwargs)

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

An SSLKey represents a user SSL key.

Users will be able to access Windows winrm service with any of the registered keys.

Variables:
  • user – The user which owns the key.
  • key – The SSL key.
display_html()

Return a compact HTML representation of this key.

Returns:The HTML representation of this key.
Return type:unicode
class maasserver.models.Tag(*args, **kwargs)

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

A Tag is a label applied to a Node.

Variables:
  • name – The short-human-identifiable name for this tag.
  • definition – The XPATH string identifying what nodes should match this tag.
  • comment – A long-form description for humans about what this tag is trying to accomplish.
  • kernel_opts – Optional kernel command-line parameters string to be used in the PXE config for nodes with this tags.
  • objects – The TagManager.
populate_nodes()

Find all nodes that match this tag, and update them.

class maasserver.models.UserProfile(*args, **kwargs)

Bases: maasserver.models.cleansave.CleanSave, django.db.models.base.Model

A User profile to store MAAS specific methods and fields.

Variables:user – The related User.
create_authorisation_token()

Create a new Token and its related Consumer (OAuth authorisation).

Returns:A tuple containing the Consumer and the Token that were created.
Return type:tuple
delete_authorisation_token(token_key)

Delete the user’s OAuth token wich key token_key.

Parameters:token_key (string) – The key of the token to be deleted.
Raises:django.http.Http404
get_authorisation_tokens()

Fetches all the user’s OAuth tokens.

Returns:A QuerySet of the tokens.
Return type:django.db.models.query.QuerySet
class maasserver.models.Zone(*args, **kwargs)

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

A Zone is an entity used to logically group nodes together.

Variables:
  • name – The short-human-identifiable name for this zone.
  • description – Free-form description for this zone.
  • objects – An instance of the class ZoneManager.
is_default()

Is this the default zone?

MAAS logo

MAAS

Metal As A Service.



Related Topics

This Page