Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

How to use the vmadm command in the latest (Dec 13, 2011) release of SmartOS.

Listing VMs

Default fields + sort:

Same, but change the field order and add some more:

Same, but sort by ram in DESCENDING order then by CPU shares in ascending order:

Same but only list those with type=OS and ram=1* (1024 or 128 in this example):

Creating a new VM

alternatively, with the same file we could just use:

Getting a VMs properties

Lookup a VM by IP

same thing, but get an array of json as results:

Looking up all 128M VMs with an alias that starts with 'a' or 'b':

same thing, but json array output:

Updating a VM

Quota for OS VMs updates live without needing a restart:

Set the quota back and adjust the cpu_shares:

You can also do an update from JSON:

Add a NIC to a VM then remove it

First list the nics so you can see what we start with:

Then add a nic:

Show it's there (we'd need to reboot the VM to actually use it though):

change the IP:

list again:

Remove the new NIC:

Back where we started:

Add a disk to a VM then remove it

First list the disks so you can see what we start with:

Then add a disk:

Show it's there (we'd need to reboot the VM to actually use it though):

Remove the new disk:

Back where we started:

Add a CDROM

You can do the same thing with CD-ROMs:

Stopping a VM

before:

then:

after:

Starting a VM

(see above for before)

after:

Rebooting a VM

Deleting a VM

before:

delete, then list again:

Moving a VM Between Servers

experimental
vmadm send and vmadm receive are currently experimental, undocumented-in-the-manpage features. Use at your own risk. They'll be documented once they are considered production-ready.

Migrate a VM to a new server (10.0.1.4)

Verify VM was transferred to the new server

Remove VM from original server

If the migration fails, you may need to manually destroy the ZFS dataset for the zone on the destination machine before you can try sending the VM again. The below error is a symptom of this:

Check to see if the ZFS dataset exists on the destination, then remove if it exists

Changing the Virtual Hardware of a KVM Zone

See also

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.