How to work with storage tags?

Hey folks, I’m testing out 2.9.2 and trying to figure out how storage tags work and are defined.
I have some servers with different storage types (SSD’s in a virtual disk, NVMe’s and HDD’s), but everything shows up tagged as ssd.

Where are the definitions of these storage tags and how can I edit these to ensure my disks get tagged correctly? If I can’t change the existing definitions, how can I add storage tags?

Looking at CLI tag management in https://maas.io/docs/snap/2.9/cli/maas-tags it does not mention storage tags or how to auto assign storage tags. The regular maas <profile> tags create --help endpoint looks like it’s meant only for regular machine/node tags.

$ maas <PROFILE> block-device add-tag --help

$ maas <PROFILE> block-device remove-tag --help

should be a good starting point.

As for the auto-defined tags, they are derived from the commissioning data MAAS gets.

def get_tags_from_block_info(block_info):
    """Return array of tags that will populate the `PhysicalBlockDevice`.

    Tags block devices for:
        rotary: Storage device with a spinning disk.
        ssd: Storage device with flash storage.
        removable: Storage device that can be easily removed like a USB
            flash drive.
        sata: Storage device that is connected over SATA.
    """
    tags = []
    if block_info["rpm"] > 0:
        tags.append("rotary")
        tags.append("%srpm" % block_info["rpm"])
    else:
        tags.append("ssd")
    if block_info["removable"]:
        tags.append("removable")
    if block_info["type"] == "sata":
        tags.append("sata")
    return tags

so if MAAS detects rpm it will tag with rotary else it assumes ssd .

Hi @sparkiegeek, thank you. I totally missed the block-device section. That could help if manual assignment is needed.

Regarding the auto-defined tags, after some double checking, it seems that the commissioning step 50-maas-01-commissioning is generating incorrect storage info such as a random serial and it’s missing the rpm for the virtual disk (behind raid controller) and the HDDs.

The commissioning step maas-lshw generates the correct info, but is not used for some reason. I have added screenshot of storage after commission and outputs from both 50-maas-01-commissioning and maas-lshw below.

What is MAAS doing wrong here and how can I fix it?

Virtual disk/RAID controller sda

50-maas-01-commissioning
                {
                    "id": "sda",
                    "device": "8:0",
                    "model": "MR9341-4i",
                    "type": "scsi",
                    "read_only": false,
                    "size": 239511535616,
                    "removable": false,
                    "numa_node": 0,
                    "device_path": "pci-0000:af:00.0-scsi-0:2:0:0",
                    "block_size": 4096,
                    "firmware_version": "4.68",
                    "rpm": 0,
                    "serial": "600605b00f3de51025a8b05005448efc",
                    "device_id": "wwn-0x600605b00f3de51025a8b05005448efc",
                    "partitions": []
                },
lshw
    <node id="scsi:0" claimed="true" class="storage">
     <physid>af</physid>
     <logicalname>scsi0</logicalname>
      <node id="disk" claimed="true" class="disk" handle="SCSI:00:02:00:00">
       <description>SCSI Disk</description>
       <product>MR9341-4i</product>
       <vendor>AVAGO</vendor>
       <physid>2.0.0</physid>
       <businfo>scsi@0:2.0.0</businfo>
       <logicalname>/dev/sda</logicalname>
       <dev>8:0</dev>
       <version>4.68</version>
       <serial>00fc8e440550b0a82510e53d0fb00506</serial>
       <size units="bytes">239511535616</size>
       <configuration>
        <setting id="ansiversion" value="5" />
        <setting id="logicalsectorsize" value="512" />
        <setting id="sectorsize" value="4096" />
       </configuration>
       <hints>
        <hint name="bus.icon" value="scsi" />
        <hint name="icon" value="disc" />
       </hints>
      </node>
    </node>

HDD sdb

50-maas-01-commissioning
                {
                    "id": "sdb",
                    "device": "8:16",
                    "model": "ST16000NM001G-2K",
                    "type": "scsi",
                    "read_only": false,
                    "size": 16000900661248,
                    "removable": false,
                    "numa_node": 0,
                    "device_path": "pci-0000:3b:00.0-sas-exp0x500304801eed80ff-phy0-lun-0",
                    "block_size": 4096,
                    "firmware_version": "SN02",
                    "rpm": 0,
                    "serial": "5000c500c38dd1d1",
                    "device_id": "wwn-0x5000c500c38dd1d1",
                    "partitions": []
                },
lshw
    <node id="scsi:1" claimed="true" class="storage">
     <physid>b0</physid>
     <logicalname>scsi5</logicalname>
      <node id="disk:0" claimed="true" class="disk" handle="SCSI:05:00:00:00">
       <description>ATA Disk</description>
       <product>ST16000NM001G-2K</product>
       <physid>0.0.0</physid>
       <businfo>scsi@5:0.0.0</businfo>
       <logicalname>/dev/sdb</logicalname>
       <dev>8:16</dev>
       <version>SN02</version>
       <serial>ZL21LG4J</serial>
       <size units="bytes">16000900661248</size>
       <capacity units="bytes">16000900661248</capacity>
       <configuration>
        <setting id="ansiversion" value="6" />
        <setting id="logicalsectorsize" value="512" />
        <setting id="sectorsize" value="4096" />
       </configuration>
       <capabilities>
        <capability id="7200rpm" >7200 rotations per minute</capability>
       </capabilities>
       <hints>
        <hint name="icon" value="disc" />
       </hints>
      </node>
    </node>

NVMe nvme0n1

50-maas-01-commissioning
                {
                    "id": "nvme0n1",
                    "device": "259:0",
                    "model": "Micron_9300_MTFDHAL3T2TDR",
                    "type": "nvme",
                    "read_only": false,
                    "size": 3200631791616,
                    "removable": false,
                    "wwn": "eui.000000000000000100a0750128fbee3c",
                    "numa_node": 0,
                    "device_path": "pci-0000:18:00.0-nvme-1",
                    "block_size": 512,
                    "firmware_version": "11300DN0",
                    "rpm": 0,
                    "serial": "202628FBEE3C",
                    "device_id": "nvme-eui.000000000000000100a0750128fbee3c",
                    "partitions": []
                },
lshw
      <node id="storage" claimed="true" class="storage" handle="PCI:0000:18:00.0" modalias="pci:v00001344d000051B2sv00001344sd00004000bc01sc08i02">
       <description>Non-Volatile memory controller</description>
       <product>Micron Technology Inc</product>
       <vendor>Micron Technology Inc</vendor>
       <physid>0</physid>
       <subproduct>Micron Technology Inc</subproduct>
       <subvendor>Micron Technology Inc</subvendor>
       <businfo>pci@0000:18:00.0</businfo>
       <version>02</version>
       <width units="bits">64</width>
       <clock units="Hz">33000000</clock>
       <configuration>
        <setting id="driver" value="nvme" />
        <setting id="latency" value="0" />
       </configuration>
       <capabilities>
        <capability id="storage" />
        <capability id="pm" >Power Management</capability>
        <capability id="msi" >Message Signalled Interrupts</capability>
        <capability id="msix" >MSI-X</capability>
        <capability id="pciexpress" >PCI Express</capability>
        <capability id="nvm_express" />
        <capability id="bus_master" >bus mastering</capability>
        <capability id="cap_list" >PCI capabilities listing</capability>
        <capability id="rom" >extension ROM</capability>
       </capabilities>
       <resources>
        <resource type="irq" value="82" />
        <resource type="memory" value="aae20000-aae23fff" />
        <resource type="memory" value="aae00000-aae1ffff" />
       </resources>
       <hints>
        <hint name="icon" value="disc" />
        <hint name="pci.class" value="0x108" />
        <hint name="pci.device" value="0x51B2" />
        <hint name="pci.subdevice" value="0x4000" />
        <hint name="pci.subvendor" value="0x1344" />
        <hint name="pci.vendor" value="0x1344" />
       </hints>
        <node id="nvme0" claimed="true" class="storage">
         <description>NVMe device</description>
         <product>Micron_9300_MTFDHAL3T2TDR</product>
         <physid>0</physid>
         <logicalname>/dev/nvme0</logicalname>
         <version>11300DN0</version>
         <serial>202628FBEE3C</serial>
         <configuration>
          <setting id="nqn" value="nqn.2016-08.com.micron:nvme:nvm-subsystem-sn-202628FBEE3C" />
          <setting id="state" value="live" />
         </configuration>
          <node id="namespace" claimed="true" class="disk">
           <description>NVMe namespace</description>
           <physid>1</physid>
           <logicalname>/dev/nvme0n1</logicalname>
           <size units="bytes">3200631791616</size>
           <configuration>
            <setting id="logicalsectorsize" value="512" />
            <setting id="sectorsize" value="512" />
           </configuration>
           <hints>
            <hint name="icon" value="disc" />
           </hints>
          </node>
        </node>
      </node>
    </node>
1 Like

This issue occurs because the MAAS machine-resources binary (src) is not using the data from lshw to get this information but rather relies on the lxd machine resource module to provide this data instead. This module in turn reads the udev filesystem to retrieve the information.

On my hardware I encounter similar problems. lswh is displaying the correct data, but since my disks for some reason do not have the ID_ATA_ROTATION_RATE_RPM property in udev they are all classified as SSDs.

1 Like

Thanks for the clarification @heilerich.

@MAAS, is there a fix or workaround for this or do we need to file a bug?

Can’t think of a workaround that’s particularly “good”. You can always go and edit the tags of a disk after a machine has commissioned (UI: Storage -> “Available disks and partitions”: Actions: Edit physical -> Delete SSD tag) - the CLI already showed earlier in the thread.

Please do file a bug for this though.

@sparkiegeek thanks for the follow up and help! I created a bug here: https://bugs.launchpad.net/maas/+bug/1921475

1 Like