Auto start enables ivm guest start with host operating system. To enable it you have to run a virsh command for each host kvm guest.
enabling auto start for a kvm guest:
my guest machine name is node1.
disabling auto start
ubuntu@kvm:~$ ls -l /etc/libvirt/qemu
enabling auto start for a kvm guest:
my guest machine name is node1.
ubuntu@kvm:~$ virsh autostart node1
disabling auto start
ubuntu@kvm:~$ virsh --disable autostart node1you can do the same thing by entering into virsh shell
ubuntu@kvm:~$ virsh Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # list Id Name State ---------------------------------------------------- 2 node1 running 3 node2 running 4 node3 running virsh # autostart node1 Domain node1 marked as autostarted virsh # autostart --disable node1 Domain node1 unmarked as autostarted virsh #if your memory is good you can even use 'id' numbers in place of vm names, like
ubuntu@kvm:~$ virsh Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # list Id Name State ---------------------------------------------------- 2 node1 running 3 node2 running 4 node3 running virsh # autostart 2 Domain node1 marked as autostarted virsh #what this feature does is, each kvm guest will have an xml file which can be edited using 'virus edit'.These files reside under '/etc/libvirt/qemu/autostart/' directory. Once you enable 'autostart' on first kvm guest, a folder named 'autostart' will be created under the above given path '/etc/libvirt/qemu/autostart/' and a softllink to kvm guest's xml file will be added under this 'autostart' folder as below.
ubuntu@kvm:~$ ls -l /etc/libvirt/qemu
-rw------- 1 root root 2302 Apr 28 18:47 node1.xml -rw------- 1 root root 2302 Apr 28 18:48 node2.xml drwxr-xr-x 2 root root 4096 May 15 11:44 autostart drwxr-xr-x 3 root root 4096 Apr 15 08:04 networks ubuntu@kvm:~$ ls -l /etc/libvirt/qemu/autostart/ total 0 lrwxrwxrwx 1 root root 25 May 15 11:44 node1.xml -> /etc/libvirt/qemu/node1.xml lrwxrwxrwx 1 root root 25 May 15 11:44 node2.xml -> /etc/libvirt/qemu/node2xmlHope you understand after looking at above output, so you can also simply create an soft link to enable autostart and also you can check if auto start for a specific guest is enabled or not.
7 Comments
This is very usefull block
ReplyDeleteThank you.
Deletevery usefull, thanks!
ReplyDeleteIn Centos 6.9 it is "autostart --disable" not "--disable autostart" FYI. Cheers.
ReplyDeleteCentOS 7.2 it is also "autostart --disable" and not "--disable autostart".
ReplyDeleteIn *buntu it is also 'autostart --disable'.
ReplyDeletevirsh autostart domain --disable for ubuntu 18.04 without entering virsh console
ReplyDelete