O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To configure a KVM guest to automatically start after a server, or libvirtd restart, run the following:

  1. Enable the VM autostart:
root@kvm:~# virsh autostart kvm1Domain kvm1 marked as autostartedroot@kvm:~#
  1. Obtain information for the instance:
root@kvm:~# virsh dominfo kvm1Id: 31Name: kvm1UUID: 6ad84d8a-229d-d1f6-ecfc-d29a25fcfa03OS Type: hvmState: runningCPU(s): 2CPU time: 10.9sMax memory: 2097152 KiBUsed memory: 1048576 KiBPersistent: yesAutostart: enableManaged save: noSecurity model: noneSecurity DOI: 0root@kvm:~#
  1. Stop the running instance and ensure that it is in the shut off state:
root@kvm:~# virsh destroy kvm1Domain kvm1 destroyedroot@kvm:~# virsh list --all Id  Name  State---------------------------------------------------- ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required