How To Configure OpenStack Instances / VMs to Autostart after Nova compute reboot

Posted on 121 views

The default configuration of OpenStack Nova compute service does not automatically start Virtual Machines each time the compute node boots or restarts. In this short guide, I’ll show you how to Configure Openstack Nova to automatically start guests that were running before the host rebooted.

openstack-list-instances-running

Login to your Openstack compute node and open Nova configuration file using your favorite file editor. I’ll go with vim.

sudo vim /etc/nova/nova.conf

Add below line under the [DEFAULT] section.

resume_guests_state_on_host_boot = True

This option specifies whether to start guests that were running before the host rebooted.

You have to restart openstack nova service after making the change in the configuration file.

sudo systemctl restart openstack-nova-compute

Option 2: Do it Manually on KVM

You can get the same result by manually turning on VM autostart feature on KVM with the virsh command line tool.

List available domains.

$ virsh  list --all
 Id    Name                           State
----------------------------------------------------
 3     instance-0000000d              running
 4     instance-0000000e              running

Get domain information.

$ virsh dominfo instance-0000000d
Id:             3
Name:           instance-0000000d
UUID:           09e738b6-fd1a-4075-a589-b3f38268b52c
OS Type:        hvm
State:          running
CPU(s):         2
CPU time:       339.5s
Max memory:     4194304 KiB
Used memory:    4194304 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: none
Security DOI:   0


$ virsh dominfo 4
Id:             4
Name:           instance-0000000e
UUID:           08df4929-4d9e-4881-9f01-6d89e9862385
OS Type:        hvm
State:          running
CPU(s):         4
CPU time:       336.1s
Max memory:     8388608 KiB
Used memory:    8388608 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: none
Security DOI:   0

You can confirm from the output the Autostart flag is set to disable. To enable it, run:

sudo virsh autostart instance-0000000d
sudo virsh autostart  instance-0000000e

Virtual machine domain ID can be used in-place of a name.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.