← Back to team overview

openstack team mailing list archive

Re: Accessing Nova DB from the Compute Host

 

Hi there!

You need to make sure that you load the settings as if you don't load them,
SQLAlchemy will try to read the default path (which it seems like it's
doing).  You can take a look at this script which interacts with the
database

https://github.com/openstack/nova/blob/master/tools/xenserver/vm_vdi_cleaner.py

It'd be helpful to paste the script as well to help us debug it.

Regards,
Mohammed Naser


On Wed, Dec 5, 2012 at 6:15 AM, Trinath Somanchi <trinath.somanchi@xxxxxxxxx
> wrote:

> Hi-
>
> I have added the correct credentials with respect to my setup.
>
> But still the same error exists.
>
> Kindly help me resolve the issue.
>
> -
> Trinath
>
>
> On Wed, Dec 5, 2012 at 4:38 PM, Razique Mahroua <razique.mahroua@xxxxxxxxx
> > wrote:
>
>> HI Trinath,
>> just add the right credentials into your .bashrc or any file the system
>> user can source :
>>
>> export SERVICE_TOKEN=admin
>>
>> export OS_TENANT_NAME=admin
>> export OS_USERNAME=admin
>> export OS_PASSWORD=openstack
>> export OS_AUTH_URL=http://$keystone-IP:5000/v2.0/
>> export SERVICE_ENDPOINT=http://$keystone-IP:35357/v2.0/
>>
>> and it would work
>>
>> Regards,
>>  *Razique Mahroua** - **Nuage & Co*
>> razique.mahroua@xxxxxxxxx
>> Tel : +33 9 72 37 94 15
>>
>>
>> Le 5 déc. 2012 à 12:04, Trinath Somanchi <trinath.somanchi@xxxxxxxxx> a
>> écrit :
>>
>> Hi-
>>
>> Is there any way with out using the nova-client from the compute host, to
>> access the nova database?
>>
>> I tried, using the /nova/db/api.py and /nova/db/sqlalchemy/api.py class
>> definitions for accessing the database but failed to get the data.
>>
>>
>> I get this error for the sample def. i have written.
>>
>>  File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/api.py", line
>> 5263, in sampledata_by_host
>>     filter(models.Instance.host == host_name).all()
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line
>> 2115, in all
>>     return list(self)
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line
>> 2227, in __iter__
>>     return self._execute_and_instances(context)
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line
>> 2240, in _execute_and_instances
>>     close_with_result=True)
>>    File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line
>> 2231, in _connection_from_session
>>     **kw)
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line
>> 730, in connection
>>     close_with_result=close_with_result)
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line
>> 736, in _connection_for_bind
>>     return engine.contextual_connect(**kwargs)
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
>> 2490, in contextual_connect
>>     self.pool.connect(),
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 224,
>> in connect
>>     return _ConnectionFairy(self).checkout()
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 387,
>> in __init__
>>     rec = self._connection_record = pool._do_get()
>>    File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 802,
>> in _do_get
>>     return self._create_connection()
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 188,
>> in _create_connection
>>     return _ConnectionRecord(self)
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 270,
>> in __init__
>>     self.connection = self.__connect()
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 330,
>> in __connect
>>     connection = self.__pool._creator()
>>   File
>> "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line
>> 80, in connect
>>     return dialect.connect(*cargs, **cparams)
>>   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py",
>> line 281, in connect
>>     return self.dbapi.connect(*cargs, **cparams)
>> *OperationalError: (OperationalError) unable to open database file None
>> None*
>>
>> Can any one help when does this error occur and how to resolve the same.
>>
>> Thanks in advance.
>>
>> --
>> Regards,
>> ----------------------------------------------
>> Trinath Somanchi,
>> +91 9866 235 130
>>
>>  _______________________________________________
>> Mailing list: https://launchpad.net/~openstack
>> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~openstack
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>>
>
>
> --
> Regards,
> ----------------------------------------------
> Trinath Somanchi,
> +91 9866 235 130
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Mohammed Naser — vexxhost
-----------------------------------------------------
D. 514-316-8872
D. 800-910-1726 ext. 200
E. mnaser@xxxxxxxxxxxx
W. http://vexxhost.com

JPEG image


References