← Back to team overview

openstack team mailing list archive

Re: debugging a db migration script

 

On 07/17/2012 11:42 AM, Jim Fehlig wrote:
Hengqing Hu wrote:
There is a test in nova:

You can run run_tests.sh in your nova root like this:
./run_tests.sh -v test_migrations
Thanks for the tip!

To set a breakpoint, you can either run

python -m pdb run_tests.py  ....

or modify your code and put in :
import pdb; pdb.set_trace()


If there is something wrong in the migration script,
it will show up in the console.
Indeed.  And easy to fix problems once you know the errors :).

Regards,
Jim

On 07/17/2012 11:59 AM, Jim Fehlig wrote:
I'm working on a patch that adds a column to the compute_nodes table in
the nova db, but it seems my db migration script fails when calling 'db
sync' in stack.sh.  I tried running the command manually, same failure:

stack@virt71:~> /opt/stack/nova/bin/nova-manage --debug -v db
sync2012-07-16 21:42:52 DEBUG nova.utils [-] backend <module
'nova.db.sqlalchemy.migration' from
'/opt/stack/nova/nova/db/sqlalchemy/migration.pyc'> from (pid=19230)
__get_backend /opt/stack/nova/nova/utils.py:484
/usr/lib64/python2.6/site-packages/sqlalchemy/pool.py:681:
SADeprecationWarning: The 'listeners' argument to Pool (and
create_engine()) is deprecated.  Use event.listen().
    Pool.__init__(self, creator, **kw)
/usr/lib64/python2.6/site-packages/sqlalchemy/pool.py:159:
SADeprecationWarning: Pool.add_listener is deprecated.  Use
event.listen()
    self.add_listener(l)
Command failed, please check log for more info

I can't find anything useful in any log (/var/log/*, /opt/stack/log/*).
I ran the above in strace and saw my migration script was opened and
then shortly thereafter writing of "Command failed, please check log for
more info" and exit(1) :).

The patch also adds a 'hypervisor_type' column to the instances table,
and that migration script succeeds!

Any hints for debugging a db migration script?

Thanks,
Jim


_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp




_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp




References