Autostarting KVM instances
Once a KVM instance has been defined and started, it will run until the host OS is up. Once the host OS restarts, instances build with libvirt will not automatically start once the host is up and the libvirt
daemon is running. In this recipe, we are going to change this behavior and ensure virtual instance start when the libvirt
daemon starts.
Getting ready
For this recipe, we are going to need a single KVM instance build with libvirt.
How to do it...
To configure a KVM guest to automatically start after a server, or libvirtd
restart, run the following:
- Enable the VM
autostart
:
root@kvm:~# virsh autostart kvm1 Domain kvm1 marked as autostarted root@kvm:~#
- Obtain information for the instance:
root@kvm:~# virsh dominfo kvm1 Id: 31 Name: kvm1 UUID: 6ad84d8a-229d-d1f6-ecfc-d29a25fcfa03 OS Type: hvm State: running CPU(s): 2 CPU time: 10.9s Max memory: 2097152 KiB Used memory: 1048576 KiB Persistent: yes Autostart: enable Managed save: no Security model: none Security DOI:...