MAAS tags

Tag definitions     Tag listing and tags as search filters     Tag assignment     Tag management     


Using MAAS tags, you can easily deploy services on machines that meet certain criteria. Tags are a convenient way to assign descriptive words to machines, interfaces, and storage devices.

MAAS supports XPath expressions in tags (see below), which makes auto-assigning tags to matching hardware possible. For instance, you could tag nodes that possess fast GPUs and then deploy software that used GPU-accelerated CUDA or OpenCL libraries.

Because Juju is the recommended way to deploy services on machines managed by MAAS (see below), it supports MAAS tags for application deployments.

To understand the power of MAAS tags, you must understand tag definitions.

Tag definitions

A tag definition is the criteria by which nodes are auto-labelled by the corresponding tag. During node enlistment, MAAS collects hardware information (using the lshw utility). The definition used in creating a tag is then constructed using an XPath expression based on that information. See w3schools documentation for details on XPath.

The collected data for each node, viewable (in both XML and YAML) in the web UI, is inspected by you for the desired property. Building on the example alluded to above, a property can be a GPU with a clock speed greater than 1GHz. In this case, the following excerpt from a node’s data (in XML format) is pertinent:

      <lshw:node id="display" class="display" handle="PCI:0000:00:02.0">
       <lshw:description>VGA compatible controller</lshw:description>
       <lshw:product>GD 5446</lshw:product>
       <lshw:vendor>Cirrus Logic</lshw:vendor>
       <lshw:physid>2</lshw:physid>
       <lshw:businfo>pci@0000:00:02.0</lshw:businfo>
       <lshw:version>00</lshw:version>
       <lshw:width units="bits">32</lshw:width>
       <lshw:clock units="Hz">33000000</lshw:clock>
       <lshw:configuration>
        <lshw:setting id="latency" value="0"/>
       </lshw:configuration>
       <lshw:capabilities>
        <lshw:capability id="vga_controller"/>
       </lshw:capabilities>
       <lshw:resources>
        <lshw:resource type="memory" value="fc000000-fdffffff"/>
        <lshw:resource type="memory" value="febd0000-febd0fff"/>
        <lshw:resource type="memory" value="febc0000-febcffff"/>
       </lshw:resources>
      </lshw:node>

MAAS nodes will be selected based on these XPath predicates:

  • element of ‘node’
  • with an attribute of ‘id’
  • whose value is ‘display’
  • and has a child element of ‘clock units=“Hz”’

After adding the speed criteria via an XPath operator we end up with this as our tag definition:

//node[@id="display"]/'clock units="Hz"' > 1000000000

Tag listing and tags as search filters

To list all tags, visit the ‘Machines’ tab and expand the ‘Tags’ subsection in the left pane.

In this view, you can use tags as node search filters. Select one or several tags. The nodes that satisfy all selected tags will display on the right pane. Notice there is a search field at the top of the right pane. You can type a search expression into this field.

Below, tag ‘virtual’ has been selected (with the mouse), and the search field automatically reflects this. Five nodes satisfy this search filter.

Remove a tag from the search filter by either hitting the ‘x’ character alongside a tag or editing the search expression.

Tag assignment

To view a node’s currently assigned tags, stay on the ‘Machines’ page and click on the node in question. MAAS will display currently-assigned tags in the Tags pane of the ‘Machine summary’.

Select the ‘Configuration’ tab and then the ‘Edit’ button alongside ‘Machine configuration’ to edit tags:

  • To unassign a tag hit the ‘x’ character alongside a tag.
  • To create a basic tag, type the name of the new tag in the ‘Add a tag’ field and hit Enter. The tag will be created and automatically assigned to the node. Repeat if desired.
  • To assign an existing tag, type at least three characters to trigger a real-time search. Any resulting tags will show up in a drop-down menu. Select as desired.

You can apply changes by pressing the ‘Save changes’ button.

New tags become available as a filter in the ‘Machines’ page in the web UI immediately after you add them.

Tags for network interfaces

It’s also possible to assign tags to specific network interfaces. You can use these tags when searching for nodes within the web UI and when allocating machines from the API.

Network interface tags can only be assigned when a node is in either a ‘Ready’ or a ‘Broken’ state.

With the machine selected from the ‘Machines’ page, on the ‘Interfaces’ tab use the ‘Edit Physical’ button from the ‘Actions’ menu icon to the right of an interface:

To add a tag, type its name into the ‘Tags’ field and press Enter. Repeat as desired. Use the small ‘x’ next to a tag to unassign the tag.

You can apply changes by pressing the ‘Save’ button.

Tags for storage configuration

Alongside tags for an entire node and network interfaces, you can also define tags for storage devices. You can use these tags like any other, when searching for nodes within the web UI, where they appear beneath the ‘Storage tag’ filter, and when allocating machines from the API.

To add a tag to a storage device, click on the machine with the storage you wish to tag on the ‘Machines’ page of the web UI and open the ‘Storage’ tab. Use the menu in the ‘Actions’ column beneath ‘Available disks and partitions’ to select ‘Edit disk’ for your chosen device:

To add a tag, type its name into the ‘Tags’ field and press Enter. Repeat as desired. Use the small ‘x’ next to a tag to unassign the tag.

You can apply changes by pressing the ‘Save’ button.

Tag management

At this time, other than simple tag assignments as demonstrated above, the best way to manage MAAS tags is by using the CLI (see CLI Tag management). Juju integration is also covered there.