Module for running vmadm command on SmartOS
Create a new vm
json file to create the vm from -- if present, all other options will be ignored
options to set for the vm
CLI Example:
salt '*' vmadm.create from_file=/tmp/new_vm.json
salt '*' vmadm.create image_uuid='...' alias='...' nics='[{ "nic_tag": "admin", "ip": "198.51.100.123", ...}, {...}]' [...]
Create snapshot of a vm
vm to be targeted
The snapname must be 64 characters or less and must only contain alphanumeric characters and characters in the set [-_.:%] to comply with ZFS restrictions.
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.create_snapshot 186da9ab-7392-4f55-91a5-b8f1fe770543 baseline
salt '*' vmadm.create_snapshot nacl baseline key=alias
Delete a vm
vm to be deleted
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.delete nacl key=alias
Delete snapshot of a vm
vm to be targeted
The snapname must be 64 characters or less and must only contain alphanumeric characters and characters in the set [-_.:%] to comply with ZFS restrictions.
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.delete_snapshot 186da9ab-7392-4f55-91a5-b8f1fe770543 baseline
salt '*' vmadm.delete_snapshot nacl baseline key=alias
Output the JSON object describing a VM
vm to be targeted
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.get nacl key=alias
Lookup info on running kvm
vm to be targeted
info type to return
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.info 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.info 186da9ab-7392-4f55-91a5-b8f1fe770543 vnc
salt '*' vmadm.info nacl key=alias
salt '*' vmadm.info nacl vnc key=alias
Return a list of VMs
vmadm filter property
vmadm sort (-s) property
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
For a dict the key is the first item from the order parameter. Note: If key is not unique last vm wins.
CLI Example:
salt '*' vmadm.list
salt '*' vmadm.list order=alias,ram,cpu_cap sort=-ram,-cpu_cap
salt '*' vmadm.list search='type=KVM'
Return a list of VMs using lookup
vmadm filter property
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
return only one result (vmadm's -1)
CLI Example:
salt '*' vmadm.lookup search='state=running'
salt '*' vmadm.lookup search='state=running' order=uuid,alias,hostname
salt '*' vmadm.lookup search='alias=nacl' one=True
Reboot a vm
vm to be rebooted
force reboot of vm if true
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.reboot 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.reboot 186da9ab-7392-4f55-91a5-b8f1fe770543 True
salt '*' vmadm.reboot vm=nacl key=alias
salt '*' vmadm.reboot vm=nina.example.org key=hostname
Receive a vm from a directory
uuid of vm to be received
source directory
CLI Example:
salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
Reprovision a vm
vm to be reprovisioned
uuid of new image
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.reprovision 186da9ab-7392-4f55-91a5-b8f1fe770543 c02a2044-c1bd-11e4-bd8c-dfc1db8b0182
salt '*' vmadm.reprovision nacl c02a2044-c1bd-11e4-bd8c-dfc1db8b0182 key=alias
Rollback snapshot of a vm
vm to be targeted
The snapname must be 64 characters or less and must only contain alphanumeric characters and characters in the set [-_.:%] to comply with ZFS restrictions.
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.rollback_snapshot 186da9ab-7392-4f55-91a5-b8f1fe770543 baseline
salt '*' vmadm.rollback_snapshot nacl baseline key=alias
Send a vm to a directory
vm to be sent
target directory
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.send 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
salt '*' vmadm.send vm=nacl target=/opt/backups key=alias
Start a vm
vm to be started
optional additional options
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.start 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.start 186da9ab-7392-4f55-91a5-b8f1fe770543 'order=c,once=d cdrom=/path/to/image.iso,ide'
salt '*' vmadm.start vm=nacl key=alias
salt '*' vmadm.start vm=nina.example.org key=hostname
Stop a vm
vm to be stopped
force stop of vm if true
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.stop 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.stop 186da9ab-7392-4f55-91a5-b8f1fe770543 True
salt '*' vmadm.stop vm=nacl key=alias
salt '*' vmadm.stop vm=nina.example.org key=hostname
Send non-maskable interrupt to vm or capture a screenshot
vm to be targeted
nmi or screenshot -- Default: nmi
value type of 'vm' parameter
CLI Example:
salt '*' vmadm.sysrq 186da9ab-7392-4f55-91a5-b8f1fe770543 nmi
salt '*' vmadm.sysrq 186da9ab-7392-4f55-91a5-b8f1fe770543 screenshot
salt '*' vmadm.sysrq nacl nmi key=alias
Update a new vm
vm to be updated
json file to update the vm with -- if present, all other options will be ignored
value type of 'vm' parameter
options to update for the vm
CLI Example:
salt '*' vmadm.update vm=186da9ab-7392-4f55-91a5-b8f1fe770543 from_file=/tmp/new_vm.json
salt '*' vmadm.update vm=nacl key=alias from_file=/tmp/new_vm.json
salt '*' vmadm.update vm=186da9ab-7392-4f55-91a5-b8f1fe770543 max_physical_memory=1024