atom feed1 message in net.launchpad.lists.openstack[Openstack] A collection of utilities...
FromSent OnAttachments
Lars Kellogg-StedmanJun 26, 2012 10:08 am 
Subject:[Openstack] A collection of utilities for cleaning up the database
From:Lars Kellogg-Stedman (la@seas.harvard.edu)
Date:Jun 26, 2012 10:08:40 am
List:net.launchpad.lists.openstack

Since I've been regularly breaking things over the past few weeks I've gotten tired of manually clearing things out of the Nova database. I've written a small collection of tools to make this task easier:

https://code.seas.harvard.edu/openstack/stackutil

This is Python code which you should be able to easy_install. It requires (and easy_install will install) "cliff", a framework for command-line applications.

At the moment, it can:

- Free ip addresses that have not been correctly released. - Delete instances stuck in the BUILD or ERROR states that won't go away when you use "nova delete". - Delete volumes stuck in the "attaching" or "creating" state. - Delete disabled services.

The last one is there because I couldn't figure out how to disable services (for example, when I remove a compute node).

The code uses nova.flag.FLAG to read your nova configuration file, extract sql_connection, and then uses sqlalchemy.engine.create_engine() to create a database connection from that URL.

WARNING: This code is a terrible hack and using it could possible corrupt your database and make your OpenStack environment fall over hard. On the other hand, if you're in the early stages of testing this may save you some grief.