SmartOS – Alias property

When you create a new virtual machine in SmartOS an UUID is generated and assigned. These UUIDs are not very informative which can make it a bit hard to distinguish one virtual machine from the other.

 

Example: which one is my Slackware box?

# vmadm list
UUID                                  TYPE  RAM      STATE             ALIAS
07fc9d1d-58a6-4665-9673-93340a406ab9  KVM   512      stopped           -
47d84c19-2eae-48c6-a976-109a4c9b9db2  KVM   512      running           -

 

Luckily there is the alias property which you can assign creating the virtual machine. However if you forgot to specify the alias (like me) you can still set the property afterwards. I will show how to correct this.

 

Start by first creating a json file with the desired alias:

 

{

"alias": "sl01"

}

 

Then run the vmadm update command and use the file you just created as input:

# vmadm update 47d84c19-2eae-48c6-a976-109a4c9b9db2 < alias
 Successfully updated VM 47d84c19-2eae-48c6-a976-109a4c9b9db2

 

Which results in the alias showing up in the list command:

# vmadm list 
UUID                                  TYPE  RAM      STATE             ALIAS
07fc9d1d-58a6-4665-9673-93340a406ab9  KVM   512      stopped           -
47d84c19-2eae-48c6-a976-109a4c9b9db2  KVM   512      running           sl01

Now it is a lot easier to recognize a specific virtual machine.

 

There is one big caveat though:

 

An alias for a VM which is for display/lookup purposes only. Not required to be unique.

Quite a bummer.

 

References:

vmadm man page