18. 7. 2011

ESXGuide - vmware-cmd Command line tool

ESXGuide - vmware-cmd Command line tool


vmware-cmd VM Management in the console
vmware-cmd -l
Sample:
[root@esxhost root]# vmware-cmd -l
/vmfs/volumes/44ee9812-da790870-b7f7-00145e1b5242/cumuli/cumuli.vmx
/vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx
List path and names of .registered VM vmx files on the present host
Very important!
Use the path with the UUID (vmfslabel) where requested in vmware-cmd
use vmware-cmd -l command to retrieve the UUID
list
vmware-cmd /vmfs/volume/vmfslabel/VMName/VMName.vmx getstate
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx getstate

getstate() = on
Retrieve power state of the VM: off, on, suspended, stuck
getstat
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx reset trysoft
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx reset trysoft
reset(trysoft) = 1
Reboot the VM. First try a nice shutdown, then if necessary force a shutdown before reboot
reboot
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx start
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx start
start() = 1
Power on the VM
start
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx stop trysoft
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx stop hard
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx stop trysoft
stop(trysoft) = 1
Shutdown/halt the VM. First try a nice shutdown, then if necessary force a shutdown. Finally power off.
shutdown
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx suspend
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx suspend
suspend() = 1
Suspend the VM
suspend
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx hassnapshot
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx hassnapshot
hassnapshot() =
Query if VM has a snapshot
snapshot
vmware-cmd createsnapshot name description quiesce memory
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx createsnapshot "snap1" "before patching" quiesce memory
createsnapshot(snap1 before patching quiesce memory) = 1
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx hassnapshot
hassnapshot() = 1
Quiesce will quiesce file system writes
Memory will grab the memory state (will lose pings during this)
createsnapshot
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx revertsnapshot
Sample:
[root@vs03 root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx revertsnapshot
revertsnapshot() = 1
Revert to previous created snapshot (you loose the current VM state!)
revertsnapshot
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx removesnapshots
Sample:

[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx removesnapshots
removesnapshots() = 1

Remove previous created snapshots (you keep the current VM state!)
removesnapshots
vmware-cmd -s register vmfs/volume/vmfslabel/VMName/VMName.vmx
Sample:
[root@esxhost root]# vmware-cmd -s register /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx
register(/vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx) = 1
Register VM (add to inventory)
register
vmware-cmd -s unregister vmfs/volume/vmfslabel/VMName/VMName.vmx
Sample:
[root@esxhost root]# vmware-cmd -s unregister /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx
unregister(/vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx) = 1
Unregister VM (add to inventory)
unregister
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx answer
Sample:
[root@esxhost root]# vmware-cmd /vmfs/volumes/44ebf538-51cc7998-2525-00145e1b556a/printer/printer.vmx answer
No questions pending.

In this case there is no pending input request. If there is any pending input request you will be promptet for the answser.
answer pending request for userinput

answer

Žádné komentáře: