Thursday, July 3, 2014

Reset/Reinitialize nova (openstack)

Sometimes the contents of the nova database are not updated properly when instances are deleted through the dashboard. This creates clutter because the instances with ERROR status remain in the dashboard list and cannot be deleted (in my case, no matter how many times I try). Some guides describe how to delete the problematic instances manually by accessing the nova database then deleting the appropriate entries in the affected tables using SQL. If you are working on an experimental system, reinitializing the entire nova database may be easier and faster. Perform the steps below on the controller node. WARNING: This will delete everything in the nova database. This is tested only on the havana version of openstack.

$mysql -u root -p
mysql>drop database nova;
mysql>create database nova; 
mysql>grant all privileges on nova.* to 'nova'@'%' identified by 'yournovapassword';
mysql>grant all privileges on nova.* to 'nova'@'localhost' identified by 'yournovapassword';
mysql>flush privileges;
mysql>exit
$sudo nova-manage db sync
After issuing the above commands, you need to restart all nova services on the controller node.

$sudo service nova-api restart
$sudo service nova-cert restart
$sudo service nova-consoleauth restart
$sudo service nova-scheduler restart
$sudo service nova-conductor restart
$sudo service nova-novncproxy restart
$sudo service nova-network restart

You also need to restart nova-compute on the compute nodes.

$sudo service nova-compute restart

You may need to do the following after:
  • Add custom flavors (nova flavor-create)
  • Add VM networks (nova net-create)
  • Add floating IP pool (nova floating-ip-bulk-create)
  • Edit the security rules for a project to access instances (best done through the dashboard)
*Note: The common cause of being unable to terminate instances is that the hypervisor is unreachable.
References:

No comments: