maasserver.models

Model export and helpers for maasserver.

Functions

create_user(sender, instance, created, **kwargs)
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

BMC(*args, **kwargs) A BMC represents an existing ‘baseboard management controller’.
Bcache(*args, **kwargs) A Bcache.
BlockDevice(*args, **kwargs) A block device attached to a node.
BondInterface(id, created, updated, node, ...)
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.
BridgeInterface(id, created, updated, node, ...)
CacheSet(*args, **kwargs) A Bcache cache set.
ComponentError(*args, **kwargs) Error state of a major component of the system.
Config(*args, **kwargs) Configuration settings item.
Controller(*args, **kwargs) A node which is either a rack or region controller.
DHCPSnippet(id, created, updated, name, ...)
DNSData(*args, **kwargs) A DNSData.
DNSResource(*args, **kwargs) A DNSResource.
Device(*args, **kwargs) A non-installable node.
Domain(*args, **kwargs) A Domain.
Event(*args, **kwargs) An Event represents a MAAS event.
EventType(*args, **kwargs) A type for events.
Fabric(*args, **kwargs) A Fabric.
FanNetwork(*args, **kwargs) A FanNetwork.
FileStorage(*args, **kwargs) A simple file storage keyed on file name.
Filesystem(*args, **kwargs) A filesystem on partition or a block device.
FilesystemGroup(*args, **kwargs) A filesystem group.
HandlerDocumentation(handler)
IPRange(*args, **kwargs) Represents a range of IP addresses used for a particular purpose in MAAS, such as a DHCP range or a range of reserved addresses.
Interface(id, created, updated, node, name, ...)
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
Machine(*args, **kwargs) An installable node.
ModelBackend Authenticates against settings.AUTH_USER_MODEL.
NODE_PERMISSION Permissions relating to nodes.
NODE_TYPE Valid node types.
Node(*args, **kwargs) A Node represents a physical machine used by the MAAS Server.
NodeGroupToRackController(*args, **kwargs) Store some of the old NodeGroup data so we can migrate it when a rack controller is registered.
OwnerData(*args, **kwargs) Owner key/value data placed on a machine while it is owned.
Partition(*args, **kwargs) A partition in a partition table.
PartitionTable(*args, **kwargs) A partition table on a block device.
PhysicalBlockDevice(*args, **kwargs) A physical block device attached to a node.
PhysicalInterface(id, created, updated, ...)
RAID(*args, **kwargs) A RAID.
RackController(*args, **kwargs) A node which is running rackd.
RegionController(*args, **kwargs) A node which is running multiple regiond’s.
RegionControllerProcess(*args, **kwargs) A RegionControllerProcess that is running on a RegionController or RegionRackController.
RegionControllerProcessEndpoint(*args, **kwargs) RegionControllerProcessEndpoint is a RPC endpoint on the
RegionRackRPCConnection(*args, **kwargs) RegionRackRPCConnection records a connection between a region
SSHKey(*args, **kwargs) An SSHKey represents a user public SSH key.
SSLKey(*args, **kwargs) An SSLKey represents a user SSL key.
Service(*args, **kwargs) A service running on regiond or rackd.
Space(*args, **kwargs) A Space.
StaticIPAddress(id, created, updated, ip, ...)
Subnet(id, created, updated, name, vlan, ...)
Tag(*args, **kwargs) A Tag is a label applied to a Node.
Template(*args, **kwargs) A generic Template object, with a link to a default version and an optional custom version.
UnknownInterface(id, created, updated, 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.
VLAN(*args, **kwargs) A VLAN.
VLANInterface(id, created, updated, node, ...)
VersionedTextFile(*args, **kwargs) An immutable TextFile which keeps track of its previous versions.
VirtualBlockDevice(*args, **kwargs) A virtual block device attached to a node.
VolumeGroup(*args, **kwargs) A volume group.
Zone(*args, **kwargs) A Zone is an entity used to logically group nodes together.
class maasserver.models.BMC(*args, **kwargs)[source]

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

A BMC represents an existing ‘baseboard management controller’. For practical purposes in MAAS, this is any addressable device that can control the power state of Nodes. The BMC associated with a Node is the one expected to control its power.

Power parameters that apply to all nodes controlled by a BMC are stored here in the BMC. Those that are specific to different Nodes on the same BMC are stored in the Node model instances.

Variables:
  • ip_address – This BMC‘s IP Address.
  • power_type – The power type defines which type of BMC this is. Its value must match a power driver class name.
  • power_parameters – Some JSON containing arbitrary parameters this BMC’s power driver requires to function.
  • objects – The BMCManager.
clean()[source]

Update our ip_address if the address extracted from our power parameters has changed.

static extract_ip_address(power_type, power_parameters)[source]

Extract the ip_address from the power_parameters. If there is no power_type, no power_parameters, or no valid value provided in the power_address field, returns None.

get_client_identifiers()[source]

Return a list of identifiers that can be used to get the rpc.common.Client for this BMC.

Raises:NoBMCAccessError – Raised when no rack controllers have access to this BMC.
get_layer2_usable_rack_controllers(with_connection=True)[source]

Return a list of RackController‘s that have the ability to access this BMC directly through a layer 2 connection.

get_routable_usable_rack_controllers(with_connection=True)[source]

Return a list of RackController‘s that have the ability to access this BMC through a route on the rack controller.

get_usable_rack_controllers(with_connection=True)[source]

Return a list of RackController‘s that have the ability to access this BMC either using layer2 or routable if no layer2 are available.

is_accessible()[source]

If the BMC is accessible by at least one rack controller.

static scope_power_parameters(power_type, power_params)[source]

Separate the global, bmc related power_parameters from the local, node-specific ones.

update_routable_racks(routable_racks_ids, non_routable_racks_ids)[source]

Set the routable_rack_controllers relationship to the new information.

class maasserver.models.Bcache(*args, **kwargs)[source]

Bases: maasserver.models.filesystemgroup.FilesystemGroup

A Bcache.

class maasserver.models.BlockDevice(*args, **kwargs)[source]

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

A block device attached to a node.

actual_instance

Return the instance as its correct type.

By default all references from Django will be to BlockDevice, when the native type PhysicalBlockDevice or VirtualBlockDevice is needed use this property to get its actual instance.

add_tag(tag)[source]

Add tag to block device.

available_size

Return the available size on the block device.

create_partition_if_boot_disk()[source]

Creates a partition that uses the whole disk if this block device is the boot disk.

delete()[source]

Delete the block device.

If this block device is part of a filesystem group then it cannot be deleted.

get_available_size()[source]

Return the available size on the block device.

get_block_size()[source]

Return the block size for the block device.

get_effective_filesystem()[source]

Return the filesystem that is placed on this block device.

get_name()[source]

Return the name.

This exists so VirtualBlockDevice can override this method.

get_node()[source]

Return the name.

get_partitiontable()[source]

Returns this device’s partition table (or None, if none exists.

get_used_size()[source]

Return the used size on the block device.

is_boot_disk()[source]

Return true if block device is the boot disk.

remove_tag(tag)[source]

Remove tag from block device.

used_for

Return what the block device is being used for.

used_size

Return the used size on the block device.

class maasserver.models.BootResource(*args, **kwargs)[source]

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()[source]

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()[source]

Return latest BootResourceSet where all BootResouceFile‘s are complete.

get_latest_set()[source]

Return latest BootResourceSet.

get_next_version_name()[source]

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)[source]

Return True if the resource supports the given subarch.

class maasserver.models.BootResourceFile(*args, **kwargs)[source]

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)[source]

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.

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)[source]

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

A source for boot resources.

compare_dict_without_selections(other)[source]

Compare this BootSource, as a dict, to another, as a dict.

Only the keys url and keyring_data are relevant.

to_dict()[source]

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()[source]

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)[source]

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

A cache of an image provided in boot source.

class maasserver.models.BootSourceSelection(*args, **kwargs)[source]

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

A set of selections for a single BootSource.

to_dict()[source]

Return the current BootSourceSelection as a dict.

class maasserver.models.CacheSet(*args, **kwargs)[source]

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

A Bcache cache set.

get_device()[source]

Return the device that is apart of this cache set.

Returns either a PhysicalBlockDevice, VirtualBlockDevice, or Partition.

get_filesystem()[source]

Return the filesystem for this cache set.

get_name()[source]

Return the name of the node.

get_node()[source]

Return the node of the cache set.

name

Return the name of the cache set.

class maasserver.models.ComponentError(*args, **kwargs)[source]

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

Error state of a major component of the system.

class maasserver.models.Config(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Configuration settings item.

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

Bases: maasserver.models.node.Node

A node which is either a rack or region controller.

class maasserver.models.DHCPSnippet(id, created, updated, name, value, description, enabled, node, subnet)[source]

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

class maasserver.models.DNSData(*args, **kwargs)[source]

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

A DNSData.

Variables:
  • rrtype – Type of resource record
  • rrdata – right-hand side of the DNS Resource Record.
clean_rrdata(*args, **kwargs)[source]

verify that the rrdata matches the spec for the resource type.

class maasserver.models.DNSResource(*args, **kwargs)[source]

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

A DNSResource.

Variables:
  • name – The leftmost label for the resource. (No dots.)
  • domain – Which (forward) DNS zone does this resource go in.
  • ip_addresses – many-to-many linkage to StaticIPAddress.
  • objects – An instance of the class DNSResourceManager.
fqdn

Fully qualified domain name for this DNSResource.

Return the FQDN for this DNSResource.

get_name()[source]

Return the name of the dnsresource.

render_json(system_id)[source]

Render json. System_id is the system_id for the node, if one exists. Addresses are rendered in the calling function.

class maasserver.models.Device(*args, **kwargs)[source]

Bases: maasserver.models.node.Node

A non-installable node.

class maasserver.models.Domain(*args, **kwargs)[source]

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

A Domain.

Variables:
  • name – The DNS stuffix for this zone
  • authoritative – MAAS manages this (forward) DNS zone.
  • objects – An instance of the class DomainManager.
get_name()[source]

Return the name of the domain.

is_default()[source]

Is this the default domain?

Render a representation of this domain’s related non-IP data, suitable for converting to JSON.

Returns:data
resource_count

How many DNSResource names are attached to this domain.

resource_record_count

How many total Resource Records come from non-Nodes.

class maasserver.models.Event(*args, **kwargs)[source]

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.Fabric(*args, **kwargs)[source]

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

A Fabric.

Variables:
  • name – The short-human-identifiable name for this fabric.
  • objects – An instance of the class FabricManager.
get_name()[source]

Return the name of the fabric.

is_default()[source]

Is this the default fabric?

class maasserver.models.FanNetwork(*args, **kwargs)[source]

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

A FanNetwork.

Variables:
  • name – The short-human-identifiable name for this fannetwork.
  • objects – An instance of the class FanNetworkManager.
class maasserver.models.FileStorage(*args, **kwargs)[source]

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.Filesystem(*args, **kwargs)[source]

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

A filesystem on partition or a block device.

Variables:
  • uuid – UUID of the filesystem.
  • fstype – Type of filesystem. This can even be filesystems that cannot be mounted directly, e.g. LVM.
  • partitionPartition this filesystem is on. If empty the filesystem must be directly on a BlockDevice.
  • block_deviceBlockDevice this filesystem is on. If empty the filesystem must be on a Partition.
  • filesystem_groupFilesystemGroup this filesystem belongs to.
  • create_params – Parameters that can be passed during the mkfs command when the filesystem is created.
  • mount_point – Path to where this filesystem is mounted on the deployed operating system.
  • mount_options – Parameters that are used to mount this filesystem on the deployed operating system.
get_block_size()[source]

Block size of partition table.

get_node()[source]

Node this filesystem belongs to.

get_parent()[source]

Return linked BlockDevice or linked Partition.

get_size()[source]

Size of filesystem.

is_mountable

Return True if this is a mountable filesystem.

is_mounted

Return True if this filesystem is mounted.

uses_mount_point

True if this filesystem can be mounted on a path.

Swap partitions, for example, are not mounted at a particular point in the host’s filesystem.

uses_storage

True if this filesystem expects a block special device.

ramfs and tmpfs, for example, exist only in memory.

class maasserver.models.FilesystemGroup(*args, **kwargs)[source]

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

A filesystem group. Contains a set of filesystems that create a virtual block device. E.g. LVM Volume Group.

Variables:
  • uuid – UUID of the filesystem group.
  • group_type – Type of filesystem group.
  • name – Name of the filesytem group.
  • create_params – Parameters that can be passed during the create command when the filesystem group is created.
delete(force=False)[source]

Delete from the database.

Parameters:force – Delete any related object that prevents this object from being deleted.
get_bcache_backing_block_device()[source]

Return the block_device that is the backing device for the Bcache.

This will return the block device even if the backing is a partition.

get_bcache_backing_filesystem()[source]

Return the filesystem that is the backing device for the Bcache.

get_bcache_size()[source]

Size of this Bcache.

Calculated based on the size of the backing device. The linked VirtualBlockDevice should calculate its size from this filesystem group.

Note: Should only be called when the group_type is BCACHE.

get_lvm_allocated_size(skip_volumes=[])[source]

Returns the space already allocated to virtual block devices.

Calculated from the total size of all virtual block devices in this group.

get_lvm_free_space(skip_volumes=[])[source]

Returns the total unallocated space on this FilesystemGroup

get_lvm_size()[source]

Size of this LVM volume group.

Calculated from the total size of all filesystems in this group. Its not calculated from its virtual_block_device size.

Note: Should only be called when the group_type is LVM_VG.

get_name_prefix()[source]

Return the prefix that should be used when setting the name of this FilesystemGroup.

get_nice_name()[source]

Return the nice name for the filesystem group.

This is used when showing error or log messages.

get_node()[source]

Node this filesystem group belongs to.

get_raid_size()[source]

Size of this RAID.

Calculated based on the RAID type and how output size based on that type. The size will be calculated using the smallest size filesystem attached to this RAID. The linked VirtualBlockDevice should calculate its size from this filesystem group.

Note: Should only be called when the group_type is in
FILESYSTEM_GROUP_RAID_TYPES.
get_size()[source]

Size of this filesystem group.

Calculated from the total size of all filesystems in this group. Its not calculated from its virtual_block_device size. The linked VirtualBlockDevice should calculate its size from this filesystem group.

get_smallest_filesystem_size()[source]

Return the smallest filesystem size.

get_virtual_block_device_block_size()[source]

Return the block size that should be used on a created VirtualBlockDevice for this filesystem group.

is_bcache()[source]

Return True if group_type is BCACHE type.

is_lvm()[source]

Return True if group_type is LVM_VG type.

is_raid()[source]

Return True if group_type is a RAID type.

virtual_device

Return the linked VirtualBlockDevice.

This should never be called when the group_type is LVM_VG. virtual_devices should be used in that case, since LVM_VG supports multiple `VirtualBlockDevice`s.

class maasserver.models.IPRange(*args, **kwargs)[source]

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

Represents a range of IP addresses used for a particular purpose in MAAS, such as a DHCP range or a range of reserved addresses.

class maasserver.models.Interface(id, created, updated, node, name, type, vlan, mac_address, ipv4_params, ipv6_params, params, tags, enabled)[source]

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

claim_auto_ips(exclude_addresses=[])[source]

Claim IP addresses for this interfaces AUTO IP addresses.

Parameters:exclude_addresses – Exclude the following IP addresses in the allocation. Mainly used to ensure that the sub-transaction that runs to identify available IP address does not include the already allocated IP addresses.

Remove all the IPAddress link on the interface.

Ensure that if no subnet links exists that at least a LINK_UP exists.

Force the interface to come up with an AUTO linked to a subnet on the same VLAN as the interface. If no subnet could be identified then its just set to DHCP.

Returns all of the related interfaces (including any ancestors, successors, and ancestors’ successors).

get_ancestors()[source]

Returns all the ancestors of the interface (that is, including each parent’s parents, and so on.)

get_discovered()[source]

Return the definition of discovered IPs belonging to this interface.

Example definition:

{
    "ip_address": "192.168.1.2",
    "subnet": <Subnet object>
}
get_effective_mtu()[source]

Return the effective MTU value for this interface.

Return the definition of links connected to this interface.

Example definition:

{
    "id": 1,
    "mode": "dhcp",
    "ip_address": "192.168.1.2",
    "subnet": <Subnet object>
}

ip and subnet are optional and are only present if the StaticIPAddress has an IP address and/or subnet.

get_successors()[source]

Returns all the ancestors of the interface (that is, including each child’s children, and so on.)

classmethod get_type()[source]

Get the type of interface for this class.

Return None on Interface.

Link interface to subnet using the provided mode.

Parameters:
  • mode – Mode of the link. See INTERFACE_LINK_TYPE for vocabulary.
  • subnet – Subnet to link to. This can be None for DHCP and LINK_UP.
  • ip_address – IP address in subnet to give to the interface. Only used for STATIC mode and if not given one will be selected.
  • alloc_type – Allocation type for the link. This is only used for link mode STATIC.
  • user – When alloc_type is set to USER_RESERVED, this user will be set on the link.

Return True if this interface is only set to LINK_UP.

release_auto_ips()[source]

Release all AUTO IP address for this interface that have an IP address assigned.

Remove the IPAddress link on interface.

Parameters:clearing_config – Set to True when the entire network configuration for this interface is being cleared. This makes sure that the auto created link_up is not created.

Remove the IPAddress link on interface by its ID.

update_ip_address(static_ip, mode, subnet, ip_address=None)[source]

Update an already existing link on interface to be the new data.

update_ip_addresses(cidr_list)[source]

Update the IP addresses linked to this interface.

This only updates the DISCOVERED IP addresses connected to this interface. All other IPADDRESS_TYPE’s are left alone.

Parameters:cidr_list – A list of IP/network addresses using the CIDR format e.g. ['192.168.12.1/24', 'fe80::9e4e:36ff:fe3b:1c94/64'] to which the interface is connected.

Update the IPAddress link on interface by its ID.

class maasserver.models.LargeFile(*args, **kwargs)[source]

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)[source]

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

Percentage 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)[source]

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.Machine(*args, **kwargs)[source]

Bases: maasserver.models.node.Node

An installable node.

class maasserver.models.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.
  • node_type – The type of node. This is used to specify if the node is to be used as a node for deployment, as a device, or a rack controller
  • parent – An optional parent Node. This node will be deleted along with all its resources when the parent node gets deleted or released. This is only relevant for node types other than node.
  • 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.
  • bios_boot_method – The boot method used by the cluster to allow this node to boot. E.g. “pxe”.
  • 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.
  • bmc – The BMC / power controller for this node.
  • tags – The list of Tag`s associated with this `Node.
  • objects – The GeneralManager.
  • enable_ssh – An optional flag to indicate if this node can have ssh enabled during commissioning, allowing the user to ssh into the machine’s commissioning environment using the user’s SSH key.
  • skip_networking – An optional flag to indicate if this node networking configuration doesn’t need to be touched when it is commissioned.
abort_commissioning(user, comment=None)[source]

Power off a commissioning node and set its status to NEW.

Returns:a Deferred which contains the post-commit tasks that are required to run to stop the node. This is already registered as a post-commit hook; it should not be added a second time.
abort_deploying(user, comment=None)[source]

Power off a deploying node and set its status to ALLOCATED.

Returns:a Deferred which contains the post-commit tasks that are required to run to stop the node. This is already registered as a post-commit hook; it should not be added a second time.
abort_disk_erasing(user, comment=None)[source]

Power off disk erasing node and set a failed status.

Returns:a Deferred which contains the post-commit tasks that are required to run to stop the node. This is already registered as a post-commit hook; it should not be added a second time.
abort_operation(user, comment=None)[source]

Abort the current operation.

accept_enlistment(user)[source]

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='', comment=None)[source]

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

add_physical_interface(mac_address, name=None)[source]

Add a new PhysicalInterface to node with mac_address.

claim_auto_ips()[source]

Assign IP addresses to all interface links set to AUTO.

clean_boot_disk(prev)[source]

Check that the boot disk is either un-used or has a partition table.

It’s possible that the boot disk we are seeing is already in-use with a filesystem group or cache set.

clean_boot_interface(prev)[source]

Check that this Node’s boot interface (if present) belongs to this Node.

It’s possible, though very unlikely, that the boot interface we are seeing is already assigned to another Node. If this happens, we need to catch the failure as early as possible.

clean_status(prev)[source]

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

delete()[source]

Delete this node.

display_memory()[source]

Return memory in GiB.

display_status()[source]

Return status text as displayed to the user.

display_storage()[source]

Return storage in gigabytes.

dynamic_ip_addresses()[source]

Dynamic IP addresses allocated to this node.

end_deployment()[source]

Mark a node as successfully deployed.

fqdn

Fully qualified domain name for this node.

Return the FQDN for this host.

get_best_guess_for_default_gateways()[source]

Return the best guess for the default gateways. This is either one IPv4 gateway, one IPv6 gateway, or both.

This is determined by looking at all interfaces on the node and selecting the best possible default gateway IP. The criteria below is used to select the best possible gateway:

  1. Managed subnets over unmanaged subnets.
  2. Bond and bridge interfaces over physical interfaces.
  3. Node’s boot interface over all other interfaces except bonds and bridges.
  4. Physical interfaces over VLAN interfaces.
  5. Sticky IP links over user reserved IP links.
  6. User reserved IP links over auto IP links.
Returns:List of (interface ID, subnet ID, gateway IP) tuples.
Return type:list
get_bios_boot_method()[source]

Return the boot method the node’s BIOS booted.

get_boot_disk()[source]

Return the boot disk for this node.

get_boot_interface()[source]

Get the boot interface this node is expected to boot from.

Normally, this will be the boot interface last used in a GetBootConfig RPC request for the node, as recorded in the ‘boot_interface’ property. However, if the node hasn’t booted since the ‘boot_interface’ property was added to the Node model, this will return the node’s first interface instead.

get_boot_primary_rack_controller()[source]

Return the RackController that this node will boot from as its primary rack controller .

get_boot_purpose()[source]

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

get_boot_rack_controller()[source]

Return the RackController that this node booted from last.

This uses the boot_cluster_ip to determine which rack controller this node booted from last. If empty or not a rack controller then it will fallback to the primary rack controller for the boot interface.

get_boot_rack_controllers()[source]

Return the RackController that this node will boot from.

get_boot_secondary_rack_controller()[source]

Return the RackController that this node will boot from as its secondary rack controller .

get_commissioning_time()[source]

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

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

get_default_gateways()[source]

Return the default gateways.

Returns:Return a tuple or tuples with IPv4 and IPv6 gateway information.
Return type:tuple
get_deployment_time()[source]

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

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

get_distro_series()[source]

Return the distro series to install that 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.
get_effective_license_key()[source]

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()[source]

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()[source]

Return effective power parameters, including any defaults.

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_extra_macs()[source]

Get the MACs other that the one the node booted from.

get_next_ifname(ifnames=None)[source]

Scans the interfaces on this Node and returns the next free ifname in the format ‘ethX’, where X is zero or a positive integer.

get_osystem()[source]

Return the operating system to install that node.

get_pxe_mac_vendor()[source]

Return the vendor of the MAC address the node booted from.

get_releasing_time()[source]

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

This is the maximum time that releasing is allowed to take.

ip_addresses()[source]

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.

is_in_allocated_state()[source]

Return True if the node is in a state where it is allocated.

See status in ALLOCATED_NODE_STATUSES.

mark_broken(user, comment=None)[source]

Mark this node as ‘BROKEN’.

If the node is allocated, release it first.

mark_fixed(user, comment=None)[source]

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

on_network()[source]

Return true if the node is connected to a managed network.

physicalblockdevice_set

Return QuerySet for all PhysicalBlockDevice assigned to node.

This is need as Django doesn’t add this attribute to the Node model, it only adds blockdevice_set.

power_query()[source]

Query the power state of the BMC for this node.

This make sure either a layer-2 or a routable connection can be determined for the BMC before performing the query.

This method can be called from within the reactor or will return an EventualResult. Wait should be called on the result for the desired waiting time. Recommend timeout is 45 seconds. 30 seconds for the power_query_all and 15 seconds for the power_query.

release_auto_ips()[source]

Release IP addresses on all interface links set to AUTO.

release_or_erase(user, comment=None)[source]

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

set_default_storage_layout()[source]

Sets the default storage layout.

This is called after a node has been commissioned to set the default storage layout. This is done after commissioning because only then will the node actually have some PhysicalBlockDevice‘s.

set_initial_networking_configuration()[source]

Set the networking configuration to the default for this node.

The networking configuration is set to an initial configuration where the boot interface is set to AUTO and all other interfaces are set to LINK_UP.

This is done after commissioning has finished.

set_netboot(on=True)[source]

Set netboot on or off.

set_random_hostname()[source]

Set a random hostname.

set_storage_layout(layout, params={}, allow_fallback=True)[source]

Set storage layout for this node.

set_zone(zone)[source]

Set this node’s zone

split_arch()[source]

Return architecture and subarchitecture, as a tuple.

start_commissioning(user, enable_ssh=False, skip_networking=False, skip_storage=False)[source]

Install OS and self-test a new node.

Returns:a Deferred which contains the post-commit tasks that are required to run to start and commission the node. This is already registered as a post-commit hook; it should not be added a second time.
start_disk_erasing(user, comment=None)[source]

Erase the disks on a node.

Returns:a Deferred which contains the post-commit tasks that are required to run to start and erase the node. This is already registered as a post-commit hook; it should not be added a second time.
static_ip_addresses()[source]

Static IP addresses allocated to this node.

status_action()[source]

Returns a string representation of the most recent event action name (supplied through the status API) associated with this node, None if there are no events.

status_message()[source]

Returns a string representation of the most recent event description (supplied through the status API) associated with this node, None if there are no events.

status_name

Returns the status of the nome as a user-friendly string.

storage

Return storage in megabytes.

Compatility with API 1.0 this field needs to exist on the Node.

storage_layout_issues()[source]

Return any errors with the storage layout.

Checks that the node has / mounted. If / is mounted on bcache check that /boot is mounted and is not on bcache.

update_power_state(power_state)[source]

Update a node’s power state

virtualblockdevice_set

Return QuerySet for all VirtualBlockDevice assigned to node.

This is need as Django doesn’t add this attribute to the Node model, it only adds blockdevice_set.

class maasserver.models.OwnerData(*args, **kwargs)[source]

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

Owner key/value data placed on a machine while it is owned.

class maasserver.models.Partition(*args, **kwargs)[source]

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

A partition in a partition table.

Variables:
  • partition_tablePartitionTable this partition belongs to.
  • uuid – UUID of the partition if it’s part of a GPT partition.
  • size – Size of the partition in bytes.
  • bootable – Whether the partition is set as bootable.
delete()[source]

Delete the partition.

If this partition is part of a filesystem group then it cannot be deleted.

get_available_size()[source]

Return the available size for this partition.

get_block_size()[source]

Block size of partition.

get_effective_filesystem()[source]

Return the filesystem that is placed on this partition.

get_name()[source]

Return the name of the partition.

get_node()[source]

Node this partition belongs to.

get_partition_number()[source]

Return the partition number in the table.

get_used_size()[source]

Return the used size for this partition.

save(*args, **kwargs)[source]

Save partition.

type

Return the type.

used_for

Return what the block device is being used for.

class maasserver.models.PartitionTable(*args, **kwargs)[source]

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

A partition table on a block device.

Variables:
  • table_type – Type of partition table.
  • block_deviceBlockDevice this partition table belongs to.
add_partition(size=None, bootable=False, uuid=None)[source]

Adds a partition to this partition table, returns the added partition.

If size is omitted, the partition will extend to the end of the device.

All partition sizes will be aligned down to PARTITION_ALIGNMENT_SIZE.

get_available_size(ignore_partitions=[])[source]

Return the remaining size available for partitions.

get_block_size()[source]

Block size of partition table.

get_node()[source]

Node this partition belongs to.

get_overhead_size()[source]

Return the total amount of extra space this partition table requires.

get_size()[source]

Total usable size of partition table.

get_used_size(ignore_partitions=[])[source]

Return the used size of partitions on the table.

class maasserver.models.PhysicalBlockDevice(*args, **kwargs)[source]

Bases: maasserver.models.blockdevice.BlockDevice

A physical block device attached to a node.

class maasserver.models.PhysicalInterface(id, created, updated, node, name, type, vlan, mac_address, ipv4_params, ipv6_params, params, tags, enabled)[source]

Bases: maasserver.models.interface.Interface

class maasserver.models.RAID(*args, **kwargs)[source]

Bases: maasserver.models.filesystemgroup.FilesystemGroup

A RAID.

add_device(device, fstype)[source]

Adds a device to the array, creates the correct filesystem.

add_partition(partition, fstype)[source]

Adds a partition to the array, creates the correct filesystem.

remove_device(device)[source]

Removes the device from the RAID, removes the RAID filesystem.

Raises a ValidationError if the device is not part of the array or if the array becomes invalid with the deletion.

remove_partition(partition)[source]

Removes the partition from the RAID, removes the RAID filesystem.

Raises a ValidationError if the device is not part of the array or if the array becomes invalid with the deletion.

class maasserver.models.RackController(*args, **kwargs)[source]

Bases: maasserver.models.node.Controller

A node which is running rackd.

delete()[source]

Delete this rack controller.

get_bmc_accessible_nodes()[source]

Return QuerySet of nodes that this rack controller can access.

This looks at the IP address assigned to all BMC’s and filters out only the BMC’s this rack controller can access. Returning all nodes connected to those BMCs.

is_import_boot_images_running()[source]

Return whether the boot images are running

Raises:
  • NoConnectionsAvailable – When no connections to the rack controller are available for use.
  • crochet.TimeoutError – If a response has not been received within 30 seconds.
list_boot_images()[source]

Return a list of boot images available on the rack controller.

refresh()[source]

Refresh the hardware and networking columns of the rack controller.”

Raises:NoConnectionsAvailable – If no connections to the cluster are available.
update_interfaces(interfaces)[source]

Update the interfaces attached to the rack controller.

Parameters:interfaces – Interfaces dictionary that was parsed from /etc/network/interfaces on the rack controller.
update_rackd_status()[source]

Update the status of the “rackd” service for this rack controller.

The “rackd” service status is determined based on the number of connections it has to all region controller processes.

class maasserver.models.RegionController(*args, **kwargs)[source]

Bases: maasserver.models.node.Controller

A node which is running multiple regiond’s.

delete()[source]

Delete this region controller.

class maasserver.models.RegionControllerProcess(*args, **kwargs)[source]

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

A RegionControllerProcess that is running on a RegionController or RegionRackController.

Variables:
  • regionRegionController or RegionRackController the process is running on.
  • pid – Process ID for the process.
class maasserver.models.RegionControllerProcessEndpoint(*args, **kwargs)[source]

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

RegionControllerProcessEndpoint is a RPC endpoint on the RegionControllerProcess one endpoint is created per IP address on the RegionControllerProcess.

Variables:
  • processRegionControllerProcess for this endpoint.
  • address – IP address for the endpoint.
  • port – Port number of the endpoint.
class maasserver.models.RegionRackRPCConnection(*args, **kwargs)[source]

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

RegionRackRPCConnection records a connection between a region controller and rack controller within the MAAS communication strucutre.

This is used by the region controller to inform a user when a connection between a region controller and rack controller are missing. This is also used by the “sys_connection_{region_id}” notification event in the database to inform a region controller that it needs to manage a rack controller.

Variables:
  • endpointRegionControllerProcessEndpoint endpoint the rack controller connected to.
  • rack_controllerRackController this connection goes to.
class maasserver.models.SSHKey(*args, **kwargs)[source]

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()[source]

Return a compact HTML representation of this key.

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

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()[source]

Return a compact HTML representation of this key.

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

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

A service running on regiond or rackd.

class maasserver.models.Space(*args, **kwargs)[source]

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

A Space.

Variables:
  • name – The short-human-identifiable name for this space.
  • objects – An instance of the class SpaceManager.
get_name()[source]

Return the name of the space.

is_default()[source]

Is this the default space?

class maasserver.models.Subnet(id, created, updated, name, vlan, space, cidr, rdns_mode, gateway_ip, dns_servers, allow_proxy)[source]

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

get_dynamic_range_for_ip(ip)[source]

Return IPRange for the provided ip.

get_iprange_usage()[source]

Returns both the reserved and unreserved IP ranges in this Subnet. (This prevents a potential race condition that could occur if an IP address is allocated or deallocated between calls.)

Returns:A tuple indicating the (reserved, unreserved) ranges.
get_ipranges_in_use(exclude_addresses=[], ranges_only=False)[source]

Returns a MAASIPSet of MAASIPRange objects which are currently in use on this Subnet.

Parameters:exclude_addresses – Additional addresses to consider “in use”.
get_ipranges_not_in_use(exclude_addresses=[], ranges_only=False)[source]

Returns a MAASIPSet of ranges which are currently free on this Subnet.

Parameters:exclude_addresses – An iterable of addresses not to use.
get_smallest_enclosing_sane_subnet()[source]

Return the subnet that includes this subnet.

It must also be at least big enough to be a parent in the RFC2317 world (/24 in IPv4, /124 in IPv6).

If no such subnet exists, return None.

get_staticipaddresses_in_use()[source]

Returns a list of netaddr.IPAddress objects to represent each IP address in use in this Subnet.

is_valid_static_ip(*args, **kwargs)[source]

Validates that the requested IP address is acceptable for allocation in this Subnet (assuming it has not already been allocated).

Returns True if the IP address is acceptable, and False if not.

Does not consider whether or not the IP address is already allocated, only whether or not it is in the proper network and range.

Returns:bool

Render a representation of this subnet’s related IP addresses, suitable for converting to JSON. Optionally exclude user and node information.

validate_static_ip(ip)[source]

Validates that the requested IP address is acceptable for allocation in this Subnet (assuming it has not already been allocated).

Raises StaticIPAddressUnavailable if the address is not acceptable.

Does not consider whether or not the IP address is already allocated, only whether or not it is in the proper network and range.

Raises:StaticIPAddressUnavailable – If the IP address specified is not available for allocation.
class maasserver.models.Tag(*args, **kwargs)[source]

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()[source]

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

class maasserver.models.Template(*args, **kwargs)[source]

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

A generic Template object, with a link to a default version and an optional custom version.

Variables:
  • filename – The filename of this template (/etc/mass/templates/X)
  • default_version – The default value for this template. Useful if the template needs to be reset after an accidental edit. MAAS is responsible for the default_version; the user is not allowed to set it.
  • version – The current in-use version of this template. If this exists, the specified template will be used (rather than the default). If not specified, the default_version will be used.
class maasserver.models.UserProfile(*args, **kwargs)[source]

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()[source]

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)[source]

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()[source]

Fetches all the user’s OAuth tokens.

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

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

A VLAN.

Variables:
  • name – The short-human-identifiable name for this VLAN.
  • vid – The VLAN ID of this VLAN.
  • fabric – The Fabric this VLAN belongs to.
configure_dhcp(controllers)[source]

Configures DHCP, based on the specified list of controllers.

If the list contains zero items, DHCP will be disabled and the primary and secondary controllers will be cleared from this VLAN.

If the list contains one item, DHCP will be enabled and the primary controller will be set on this VLAN. The secondary controller will be cleared.

If the list contains two items, DHCP will be enabled and the primary and secondary controllers will be set on this VLAN.

If the argument is not a list, a duplicate controller is specified, or more than two controllers are specified, raises ValidationError.

Note that this method does not save the model object; that is left up to the caller.

Param:controllers: list
Raises:ValidationError
get_name()[source]

Return the name of the VLAN.

is_fabric_default()[source]

Is this the default VLAN in the fabric?

manage_connected_interfaces()[source]

Deal with connected interfaces:

  • delete all VLAN interfaces.
  • reconnect the other interfaces to the default VLAN of the fabric.
manage_connected_subnets()[source]

Reconnect subnets the default VLAN of the fabric.

class maasserver.models.VersionedTextFile(*args, **kwargs)[source]

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

An immutable TextFile which keeps track of its previous versions.

Variables:
  • data – The data belonging to this TextFile.
  • previous_version – Optional previous version of this file.
previous_versions()[source]

Return an iterator of this object and all previous versions.

revert(to, gc=True, gc_hook=None)[source]

Return a VersionTextFile object in this objects history.

The returned object is specified by the VersionTextFile id or a negative number with how far back to go. By default newer objects then the one returned will be removed. You can optionally provide a garbage collection hook which accepts a single parameter being the value being reverted to. This allows you to revert a value and do garbage collection when the foreign key is set to cascade.

update(new_data, comment=None)[source]

Updates this VersionedTextFile with the specified new_data and returns a newly-created VersionedTextFile. If the file has changed, it will be updated with the specified comment, if supplied.

class maasserver.models.VirtualBlockDevice(*args, **kwargs)[source]

Bases: maasserver.models.blockdevice.BlockDevice

A virtual block device attached to a node.

get_name()[source]

Return the name.

get_parents()[source]

Return the blockdevices and partition which make up this device.

class maasserver.models.VolumeGroup(*args, **kwargs)[source]

Bases: maasserver.models.filesystemgroup.FilesystemGroup

A volume group.

create_logical_volume(name, size, uuid=None)[source]

Create a logical volume in this volume group.

update_block_devices_and_partitions(block_devices, partitions)[source]

Update the block devices and partitions that are in this volume group.

class maasserver.models.Zone(*args, **kwargs)[source]

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.
device_only_set

Returns just the nodes of node_type device in this zone.

is_default()[source]

Is this the default zone?

node_only_set

Returns just the nodes of node_type node in this zone.

rack_controller_only_set

Returns just the nodes of node_type rack controller in this zone.