Lab Virtual Machines: Difference between revisions

From DISI
Jump to navigation Jump to search
No edit summary
Line 23: Line 23:
  # to get list of VMs on hypervisor
  # to get list of VMs on hypervisor
  virsh list --all
  virsh list --all
  # to start a VM
  # to start a VM
  virsh start <VM-name or VMid>
  virsh start <VM-name or VMid>
  # to shutdown a VM
  # to shutdown a VM
  virsh shutdown <VM-name or VMid>
  virsh shutdown <VM-name or VMid>
  # to force shutdown a VM (equivalent of pulling the plug on a computer)
  # to force shutdown a VM (equivalent of pulling the plug on a computer)
  virsh destroy --graceful <VM-name or VMid>
  virsh destroy --graceful <VM-name or VMid>
  # to pause a VM
  # to pause a VM
  virsh suspend <VM-name or VMid>
  virsh suspend <VM-name or VMid>
  # to unpause a VM
  # to unpause a VM
  virsh resume <VM-name or VMid>
  virsh resume <VM-name or VMid>
  # get XML file contents of VM
  # get XML file contents of VM
  virsh dumpxml <VM-name or VMid>
  virsh dumpxml <VM-name or VMid>

Revision as of 19:07, 3 January 2017

There are important VMs on both Cluster 0 and Cluster 2. Cluster 0 uses VMware while Cluster 2 uses KVM/libvirt.

Cluster 0

Significant hypervisors on Cluster 0: vmware1 (access via root with clust 0 formulax2)

VMWare Commands

Webpage that describes numerous VMware commands: http://www.doublecloud.org/2013/11/vmware-esxi-vim-cmd-command-a-quick-tutorial/

# To get a list of all VMs and obtain VMid
vim-cmd vmsvc/getallvms
# To shutdown a VM: 
vim-cmd vmsvc/power.off <VMid>
# To turn on a VM: 
vim-cmd vmsvc/power.on <VMid>


Cluster 2

kvm/libvirt commands

In order for a user to issue KVM commands, the service libvirtd must be running. Check the status of libvirtd by issuing the command: service libvirtd status. If libvirtd is not running, then you may issue command: service libvirtd start.

# to get list of VMs on hypervisor
virsh list --all
# to start a VM
virsh start <VM-name or VMid>
# to shutdown a VM
virsh shutdown <VM-name or VMid>
# to force shutdown a VM (equivalent of pulling the plug on a computer)
virsh destroy --graceful <VM-name or VMid>
# to pause a VM
virsh suspend <VM-name or VMid>
# to unpause a VM
virsh resume <VM-name or VMid>
# get XML file contents of VM
virsh dumpxml <VM-name or VMid>