How to configure NovaStack to automatically start after restarting NovaStack

The default configuration of the OpenStack Nova compute service does not automatically start virtual machines each time a compute node is started or restarted. In this short guide, I will show you how to configure Openstack Nova to automatically launch guests that run before the host restarts.

Log in to your Openstack compute node and open the Nova configuration file with your favorite file editor. I will use vim.

sudo vim /etc/nova/nova.conf

Add in the following line [DEFAULT] section.

resume_guests_state_on_host_boot = True

This option specifies whether to start a client that was running before the host rebooted.

After making changes in the configuration file, you must restart the openstack nova service.

sudo systemctl restart openstack-nova-compute

Option 2: Perform it manually on KVM

You can get the same result by manually enabling the VM auto-start feature on KVM using 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 Automatically open The flag is set to disabled. To enable it, run:

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

The virtual machine domain ID can be used instead of a name.

More Openstack articles:

How to resize an OpenStack instance / virtual machine

How to create OpenStack Cinder volume on CLI and attach to VM instance / server

How to add RHEL 8 qcow2 image to OpenStack Glance

OpenStack deployment on CentOS 7 with Packstack

How to install and configure OpenStack Client on Linux

OpenStack deployment on Ubuntu 18.04 with DevStack