LIBVIRT
virsh cheatsheet:http://blog.programster.org/kvm-cheatsheet/External Link
BASIC OPERATIONS
virsh shutdown guest1 --mode acpi virsh destroy guest1 virsh undefine guest1 virsh suspend guest1
virsh reset guest1
virsh managedsave guest1 --running # to save running state. virsh start guest1 # starts it from the point it was saved
Hypervisor level network definitions (xml) are in:
/usr/share/libvirt/networks/
Rest of them (virtual networks) are in:
/var/lib/libvirt/dnsmasq
If you edit the network with “virsh net-edit”, any changes you make won't take effect until the network is destroyed and re-started, which unfortunately will cause a all guests to lose network connectivity with the host until their network interfaces are explicitly re-attached.
SOMETIMES the only way is to produce an xml file of the current network with xmldump, destroy-undefine it , modify the xml and then define and start it!
XML config can be reloaded & activated:
virsh net-define /usr/share/libvirt/networks/default.xml
Network default defined from /usr/share/libvirt/networks/default.xml
virsh net-autostart default
Network default marked as autostarted
virsh net-start default
Network default started
Deactivate and then remove a network:
virsh net-destroy <name> virsh net-undefine <name>
For the libvirt dhcp virsh net-dhcp-leases ${net}
for net in $(virsh net-list --name); do virsh net-dhcp-leases ${net}; done
Editing the attributes of a Virtual Machine
$ virsh dumpxml foo > /tmp/foo.xml $ virsh define /tmp/foo.xml
Install restart and add vms from cli:
yum groupinstall Virtualization "Virtualization Client" \ "Virtualization Platform" "Virtualization Tools"
http://jensd.be/207/linux/install-and-use-centos-7-as-kvm-virtualization-host
Logs location:
VIRTUALBOX\\:
CLI commands:
VBoxManage list runningvms VBoxManage controlvm <vm> savestate vboxmanage import /var/tmp/eveng/EVE_Community_VM.ova VBoxManage startvm "EVE Community VM" --type=headless VBoxManage controlvm "EVE Community VM" poweroff vboxmanage showvminfo "EVE Community VM" VBoxManage modifyvm "EVE Community VM" ...
VMWARE WORKSTATION:
/var/lib/vmware/Shared VMs https://www.vmware.com/support/ws55/doc/ws_learning_cli_vmrun.html vmrun list ovftool --hideEula VMware-vSAN-Witness-201704001-5310538.ova # to deploy an ova based machine. More in https://cstan.io/?p=8972&lang=en vmware-cmd # to change an existing machine settings vmrun start /root/vmware/vm-copy-me_do-not-modify/vm-copy-me_do-not-modify.vmx nogui vmrun start /root/vmware/EVE_Community_VM/EVE_Community_VM.vmx nogui
(general) VMWARE NOTES TRICKS
hwclock --hctosys # to sync the vm clock with the hypervisor (vms can take the clock from it instead of ntp based)