There are various ways to start virtual machines at at boot time. This means you don’t have to type virsh start vmName command. This can be done by marking a vm as autostart. To configure a domain to be automatically started at boot. It will create an softlink at /etc/libvirt/qemu/autostart/. So if your VM name is mailserver1, your config file name should be /etc/libvirt/qemu/mailserver1.xml and the softlink should be created at /etc/libvirt/qemu/autostart/mailserver1.xml
Advertisement
KVM: Autostart a Domain / VM Command
Type the following command:
virsh autostart vmName virsh autostart mailserver1
Sample outputs:
Domain mailserver1 marked as autostarted
Also, make sure /etc/init.d/libvirtd service is stared on boot:chkconfig libvirtd on
ORsystemctl enable libvirtd
How do I disable autostarting a domain/VMs
The syntax is:virsh autostart VMNameHere --disable
To disable auto starting freebsd vm, enter:virsh autostart freebsd --disable
Sample outputs:
Domain freebsd unmarked as autostarted