[Openstack] [Trove] Unable to list databases and other api calls in Ubuntu 14.04 packaged install

Mark Kirkwood mark.kirkwood at catalyst.net.nz
Wed Jun 4 00:56:56 UTC 2014


On 29/05/14 17:16, Mark Kirkwood wrote:
> On 23/05/14 14:54, Mark Kirkwood wrote:
>
>>
>> $ trove database-list 5d5f1a47-973d-4e11-8937-73b971a94688
>> ERROR: The resource could not be found.
>>
>> This seems to be due to missing routes:
>>
>> 2014-05-23 14:34:08.386 1376 DEBUG routes.middleware [-] No route
>> matched for GET
>> /51f1e3dd3c1d4124ae26cdcd85030eb5/instances/5d5f1a47-973d-4e11-8937-73b971a94688/databases
>>
>> __call__ /usr/lib/python2.7/dist-packages/routes/middleware.py:97
>> 2014-05-23 14:34:08.386 1376 DEBUG routes.middleware [-] No route
>> matched for GET
>> /51f1e3dd3c1d4124ae26cdcd85030eb5/instances/5d5f1a47-973d-4e11-8937-73b971a94688/databases
>>
>> __call__ /usr/lib/python2.7/dist-packages/routes/middleware.py:97
>> 2014-05-23 14:34:08.389 1376 INFO eventlet.wsgi
>> [req-6ff08fd3-90e6-4893-aaab-e645f6b82407
>> 3a0eb39ed587491aba95b5ca15e167be 51f1e3dd3c1d4124ae26cdcd85030eb5 - - -]
>> 192.168.122.33 - - [23/May/2014 14:34:08] "GET
>> /v1.0/51f1e3dd3c1d4124ae26cdcd85030eb5/instances/5d5f1a47-973d-4e11-8937-73b971a94688/databases
>>
>> HTTP/1.1" 404 208 0.052359
>>
>> I have an equivalent-ish devstack system configured the same (but
>> slightly later openstack version), and that works fine viz:
>>
>> $ trove database-list f164a72e-e627-427e-b962-f12b795499c0
>>
>> 2014-05-23 14:28:59.331 DEBUG routes.middleware [-] Matched GET
>> /c081f35aa9d94dda8dc4f2686f855b37/instances/f164a72e-e627-427e-b962-f12b795499c0/databases
>>
>> from (pid=21402) __call__
>> /usr/lib/python2.7/dist-packages/routes/middleware.py:100
>> 2014-05-23 14:28:59.332 DEBUG routes.middleware [-] Route path:
>> '/{tenant_id}/instances/:instance_id/databases', defaults: {'action':
>> u'index', 'controller': <trove.common.wsgi.Resource object at
>> 0x4515190>} from (pid=21402) __call__
>> /usr/lib/python2.7/dist-packages/routes/middleware.py:102
>> 2014-05-23 14:28:59.332 DEBUG routes.middleware [-] Match dict:
>> {'instance_id': u'f164a72e-e627-427e-b962-f12b795499c0', 'tenant_id':
>> u'c081f35aa9d94dda8dc4f2686f855b37', 'controller':
>> <trove.common.wsgi.Resource object at 0x4515190>, 'action': u'index'}
>> from (pid=21402) __call__
>> /usr/lib/python2.7/dist-packages/routes/middleware.py:103
>>
>> I've attached the config files from the 14.04 trove install - any
>> thoughts welcome!
>>
>
> Doing a bit of digging, amending routes/middleware.py (line 92 onwards)
> with:
>
>          if self.log_debug:
>              urlinfo = "%s %s" % (environ['REQUEST_METHOD'],
> environ['PATH_INFO'])
>              if 'databases' in urlinfo:
>                  log.debug("Route table\n %s", self.mapper.__str__())
>
> and comparing between the resulting devstack and packaged tables (see
> attached) makes it plain that I'm missing the database routes. I'm going
> to hunt around and try to see where these are being set (and why they
> are not more to the point). If anyone happens to know this stuff well,
> please chime in and save me :-)
>

Some progress on this saga. I have identified the cause, and found a 
workaround.

The cause:

Extensions are not being initialized at all. In 
trove/openstack/common/extensions.py the code does stuff like:

     def __init__(self, path):
         self.path = path
         self.extensions = {}
         self._load_all_extensions()

     def _load_all_extensions(self):

         if os.path.exists(self.path):
             LOG.debug(_('Loading extensions from %s'),  self.path)
             self._load_all_extensions_from_path(self.path)

Doing some probing 'path' is set to 'trove/extensions/routes', however 
the init script for troveapi sets cwd to /var/lib/trove. Therefore the 
code is going to look in /var/lib/trove/trove/extensions/routes for 
extensions... which of course does not exist, so we quietly fail to load 
any extensions.

In the devstack case stack.sh is ensuring our cwd is /opt/stack/trove 
which will make the extension code look in 
/opt/stack/trove/trove/extensions/routes which *does* exist.

So short version - code appears to only works nicely in devstack. I 
amended the init scri[t for trove-api to set cwd to 
/usr/lib/python2.7/dist-packages, which makes extensions load ok (and - 
at last - makes database list and other api calls work). I'll look 
deeper and see if there is a way to tell trove use something more 
sensible in 'path' (i.e not a relative path)...so we can avoid making 
the service cd into the python lib! If not I'll raise an issue.

Cheers

Mark




More information about the Openstack mailing list