Comment 4 for bug 1684861

Revision history for this message
Saverio Proto (zioproto) wrote :

If you messed up the database during the upgrade from Kilo to Liberty following the workaround of bug 1511466 (comments #3 and #9) you can use this python script to fix your database:

import MySQLdb
conn = MySQLdb.connect(host = '127.0.0.1', user = 'nova', passwd = 'my-secret-pw', db = 'nova')
cursor = conn.cursor()

cursor.execute("select instance_uuid from instance_extra;")
instance_extra_t = cursor.fetchall()
cursor.execute("select uuid from instances;")
instances_t = cursor.fetchall()

todelete_list = []

for extra in instance_extra_t:
    if extra not in instances_t:
        todelete_list.append(extra)

for uuid in todelete_list:
    cmd = "delete from instance_extra where instance_uuid='%s';" % uuid
    result = cursor.execute(cmd)
    conn.commit()