Horizon dashboard fails installing murano via devstack

Asked by Calum Loudon

Hi

I'm a murano newbie and am trying to install murano as per http://murano.readthedocs.org/en/latest/install/index.html#installing-and-running-the-development-version. This seems to install a working OpenStack, including Murano, apart from the Horizon dashboard, which gives a "no such table: django_session" error when I attempt to access it.

I'm running a 3-node set-up consisting of one controller node and two compute nodes. Host OS is CentOS 7. I followed the instructions above i.e.
- cloned devstack
- cloned murano
- switched to kilo-stable in both i.e. git checkout stable/kilo
- copied lib/murano, lib/murano-dashboard and extras.d/70-murano.sh
- included the following in my local.conf on the controller node:
    # Enable Murano
    enable_service heat,h-api,h-api-cfn,h-api-cfw,h-eng
    enable_service murano,murano-api,murano-engine
- ran ./stack.sh which completed with no errors.

Before doing this I had run a vanilla devstack install to verify that worked, which it did (including Horizon), then unstack'd it.

The murano-api and murano-engine windows within screen show no errors. After 'source openrc admin admin' I can use the CLI for murano fine e.g.

[stack@kilo-control devstack]$ murano category-list
+----------------------------------+---------------------+
| ID | Name |
+----------------------------------+---------------------+
| 2221f232d4074d7ebdc8a8f0a9de8743 | Big Data |
| 3db489778e104c0dbbab52b42f4e32a3 | Key-Value Storage |
| 4a2d0b061ef3405fb7df080721457f99 | SAP |
| 5e2718b558fe41bb8e968dbdded608bf | Web |
| 9f40eca3450141a2ab1777bffa7dca4f | Databases |
| a888e8c3b9c449dab8a5e98380abe297 | Application Servers |
| bbcbc5b2b8fc4deba66c9b2d84b68b32 | Message Queue |
| e218cca651c34f4b95ca88f914f9a91a | Load Balancers |
| e59ca19d4ccd43e48b4842872d38f2c2 | Microsoft Services |
+----------------------------------+---------------------+

However, when I try to access Horizon on the controller node (i.e. http://<controller node hostname>) it fails with this:

OperationalError at /
no such table: django_session
Request Method: GET
Request URL: http://kilo-control/
Django Version: 1.6.11
Exception Type: OperationalError
Exception Value:
no such table: django_session
Exception Location: /usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 452
Python Executable: /usr/bin/python
Python Version: 2.7.5
Python Path:
['/opt/stack/horizon/openstack_dashboard/wsgi/../..',
 '/opt/stack/keystone',
 '/opt/stack/glance',
 '/opt/stack/cinder',
 '/opt/stack/nova',
 '/opt/stack/horizon',
 '/opt/stack/swift',
 '/opt/stack/neutron',
 '/opt/stack/heat',
 '/opt/stack/python-muranoclient',
 '/opt/stack/murano',
 '/opt/stack/murano-dashboard',
 '/usr/lib64/python27.zip',
 '/usr/lib64/python2.7',
 '/usr/lib64/python2.7/plat-linux2',
 '/usr/lib64/python2.7/lib-tk',
 '/usr/lib64/python2.7/lib-old',
 '/usr/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7/site-packages',
 '/usr/lib/python2.7/site-packages',
 '/opt/stack/horizon/openstack_dashboard']
Server time: Mon, 15 Jun 2015 13:19:03 +0000

The horizon window in the screen shows this:

2015-06-15 13:19:02.958952 Internal Server Error: /
2015-06-15 13:19:02.958985 Traceback (most recent call last):
2015-06-15 13:19:02.958990 File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 88, in get_response
2015-06-15 13:19:02.958995 response = middleware_method(request)
2015-06-15 13:19:02.958999 File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/middleware.py", line 93, in process_request
2015-06-15 13:19:02.959154 if not hasattr(request, "user") or not request.user.is_authenticated():
2015-06-15 13:19:02.959159 File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 213, in inner
2015-06-15 13:19:02.959163 self._setup()
2015-06-15 13:19:02.959166 File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 298, in _setup
2015-06-15 13:19:02.959170 self._wrapped = self._setupfunc()
2015-06-15 13:19:02.959173 File "/usr/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 18, in <lambda>
2015-06-15 13:19:02.959179 request.user = SimpleLazyObject(lambda: get_user(request))
2015-06-15 13:19:02.959183 File "/usr/lib/python2.7/site-packages/openstack_auth/utils.py", line 54, in middleware_get_user
2015-06-15 13:19:02.959218 request._cached_user = get_user(request)
2015-06-15 13:19:02.959238 File "/usr/lib/python2.7/site-packages/openstack_auth/utils.py", line 60, in get_user
2015-06-15 13:19:02.959258 user_id = request.session[auth.SESSION_KEY]
2015-06-15 13:19:02.959278 File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 47, in __getitem__
2015-06-15 13:19:02.959299 return self._session[key]
2015-06-15 13:19:02.959321 File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 173, in _get_session
2015-06-15 13:19:02.959340 self._session_cache = self.load()
2015-06-15 13:19:02.959361 File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py", line 20, in load
2015-06-15 13:19:02.959380 expire_date__gt=timezone.now()
2015-06-15 13:19:02.959399 File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
2015-06-15 13:19:02.959420 return self.get_queryset().get(*args, **kwargs)
2015-06-15 13:19:02.959439 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 304, in get
2015-06-15 13:19:02.959460 num = len(clone)
2015-06-15 13:19:02.959480 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 77, in __len__
2015-06-15 13:19:02.959499 self._fetch_all()
2015-06-15 13:19:02.959519 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 857, in _fetch_all
2015-06-15 13:19:02.959539 self._result_cache = list(self.iterator())
2015-06-15 13:19:02.959557 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 220, in iterator
2015-06-15 13:19:02.959579 for row in compiler.results_iter():
2015-06-15 13:19:02.959599 File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 713, in results_iter
2015-06-15 13:19:02.959618 for rows in self.execute_sql(MULTI):
2015-06-15 13:19:02.959645 File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
2015-06-15 13:19:02.959672 cursor.execute(sql, params)
2015-06-15 13:19:02.959691 File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 69, in execute
2015-06-15 13:19:02.959711 return super(CursorDebugWrapper, self).execute(sql, params)
2015-06-15 13:19:02.959729 File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
2015-06-15 13:19:02.959749 return self.cursor.execute(sql, params)
2015-06-15 13:19:02.959767 File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
2015-06-15 13:19:02.959788 six.reraise(dj_exc_type, dj_exc_value, traceback)
2015-06-15 13:19:02.959808 File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
2015-06-15 13:19:02.959829 return self.cursor.execute(sql, params)
2015-06-15 13:19:02.959850 File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 452, in execute
2015-06-15 13:19:02.959869 return Database.Cursor.execute(self, query, params)
2015-06-15 13:19:02.959889 OperationalError: no such table: django_session

I have tried the whole procedure three times now with the same results. I have also used devstack to install horizon on one of the compute nodes *without* any of the murano deltas - that horizon is working fine.

It doesn't appear to be the same issue as https://blueprints.launchpad.net/murano/+spec/devstack-fix-horizon-database-storage as I have not rebooted since install and /tmp/murano/openstack-dashboard.sqlite exists and is 30KB in size.

In case it's relevant, here's what's in my DB:
MariaDB [murano]> show tables;
+----------------------+
| Tables_in_murano |
+----------------------+
| alembic_version |
| apistats |
| category |
| class_definition |
| environment |
| environment-template |
| instance_stats |
| locks |
| package |
| package_to_category |
| package_to_tag |
| session |
| status |
| tag |
| task |
+----------------------+
15 rows in set (0.00 sec)

Any help welcome!

Question information

Language:
English Edit question
Status:
Solved
For:
Murano Edit question
Assignee:
No assignee Edit question
Solved by:
Calum Loudon
Solved:
Last query:
Last reply:
Revision history for this message
Ekaterina Chernova (efedorova) said :
#1

Hi!

Murano desvtack script adds database to store dashboard session data tp /tmp

Try to run /usr/share/openstack_dashboard/manage.pt sync db and replay with 'no'

Revision history for this message
Calum Loudon (calum-loudon) said :
#2

Thanks for the quick reply. I don't have a /usr/share/openstack_dashboard/manage.pt but I do have /opt/stack/murano-dashboard/manage.py and /opt/stack/horizon/manage.py - is it the first of these I should be running?

Revision history for this message
Ekaterina Chernova (efedorova) said :
#3

Sorry, not familiar with the devstack installation :)

opt/stack/horizon/manage.py <---- this one

Revision history for this message
Calum Loudon (calum-loudon) said :
#4

I ran 'opt/stack/horizon/manage.py syncdb':

[stack@kilo-control devstack]$ /opt/stack/horizon/manage.py syncdb
DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_serialization instead.
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

then restarted httpd (sudo systemctl restart httpd) but unfortunately it made no difference:

OperationalError at /
no such table: django_session
Request Method: GET
Request URL: http://kilo-control/
Django Version: 1.6.11
Exception Type: OperationalError
Exception Value:
no such table: django_session
Exception Location: /usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 452
Python Executable: /usr/bin/python
Python Version: 2.7.5
Python Path:
['/opt/stack/horizon/openstack_dashboard/wsgi/../..',
 '/opt/stack/keystone',
 '/opt/stack/glance',
 '/opt/stack/cinder',
 '/opt/stack/nova',
 '/opt/stack/horizon',
 '/opt/stack/swift',
 '/opt/stack/neutron',
 '/opt/stack/heat',
 '/opt/stack/python-muranoclient',
 '/opt/stack/murano',
 '/opt/stack/murano-dashboard',
 '/usr/lib64/python27.zip',
 '/usr/lib64/python2.7',
 '/usr/lib64/python2.7/plat-linux2',
 '/usr/lib64/python2.7/lib-tk',
 '/usr/lib64/python2.7/lib-old',
 '/usr/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7/site-packages',
 '/usr/lib/python2.7/site-packages',
 '/opt/stack/horizon/openstack_dashboard']
Server time: Mon, 15 Jun 2015 14:40:42 +0000

2015-06-15 14:40:41.391766 DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
2015-06-15 14:40:41.391981 DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_serialization instead.
2015-06-15 14:40:42.321526 INFO:muranodashboard.common.cache:Creating apps cache directory located at /tmp/murano/apps
2015-06-15 14:40:42.321775 INFO:muranodashboard.common.cache:Using apps cache directory located at /tmp/murano/apps
2015-06-15 14:40:42.323177 INFO:muranodashboard.dynamic_ui.services:Using cache directory located at /tmp/murano
2015-06-15 14:40:42.376707 Internal Server Error: /
2015-06-15 14:40:42.376732 Traceback (most recent call last):
2015-06-15 14:40:42.376735 File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 88, in get_response
2015-06-15 14:40:42.376738 response = middleware_method(request)
2015-06-15 14:40:42.376740 File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/middleware.py", line 93, in process_request
2015-06-15 14:40:42.376743 if not hasattr(request, "user") or not request.user.is_authenticated():
2015-06-15 14:40:42.376755 File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 213, in inner
2015-06-15 14:40:42.376758 self._setup()
2015-06-15 14:40:42.376760 File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 298, in _setup
2015-06-15 14:40:42.376762 self._wrapped = self._setupfunc()
2015-06-15 14:40:42.376764 File "/usr/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 18, in <lambda>
2015-06-15 14:40:42.376767 request.user = SimpleLazyObject(lambda: get_user(request))
2015-06-15 14:40:42.376769 File "/usr/lib/python2.7/site-packages/openstack_auth/utils.py", line 54, in middleware_get_user
2015-06-15 14:40:42.377054 request._cached_user = get_user(request)
2015-06-15 14:40:42.377058 File "/usr/lib/python2.7/site-packages/openstack_auth/utils.py", line 60, in get_user
2015-06-15 14:40:42.377060 user_id = request.session[auth.SESSION_KEY]
2015-06-15 14:40:42.377062 File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 47, in __getitem__
2015-06-15 14:40:42.377064 return self._session[key]
2015-06-15 14:40:42.377067 File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 173, in _get_session
2015-06-15 14:40:42.377069 self._session_cache = self.load()
2015-06-15 14:40:42.377071 File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py", line 20, in load
2015-06-15 14:40:42.377073 expire_date__gt=timezone.now()
2015-06-15 14:40:42.377075 File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
2015-06-15 14:40:42.377077 return self.get_queryset().get(*args, **kwargs)
2015-06-15 14:40:42.377079 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 304, in get
2015-06-15 14:40:42.377081 num = len(clone)
2015-06-15 14:40:42.377083 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 77, in __len__
2015-06-15 14:40:42.377085 self._fetch_all()
2015-06-15 14:40:42.377088 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 857, in _fetch_all
2015-06-15 14:40:42.377103 self._result_cache = list(self.iterator())
2015-06-15 14:40:42.377106 File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 220, in iterator
2015-06-15 14:40:42.377108 for row in compiler.results_iter():
2015-06-15 14:40:42.377110 File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 713, in results_iter
2015-06-15 14:40:42.377113 for rows in self.execute_sql(MULTI):
2015-06-15 14:40:42.377115 File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
2015-06-15 14:40:42.377117 cursor.execute(sql, params)
2015-06-15 14:40:42.377119 File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 69, in execute
2015-06-15 14:40:42.377121 return super(CursorDebugWrapper, self).execute(sql, params)
2015-06-15 14:40:42.377123 File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
2015-06-15 14:40:42.377125 return self.cursor.execute(sql, params)
2015-06-15 14:40:42.377127 File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
2015-06-15 14:40:42.377130 six.reraise(dj_exc_type, dj_exc_value, traceback)
2015-06-15 14:40:42.377132 File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
2015-06-15 14:40:42.377134 return self.cursor.execute(sql, params)
2015-06-15 14:40:42.377136 File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 452, in execute
2015-06-15 14:40:42.377142 return Database.Cursor.execute(self, query, params)
2015-06-15 14:40:42.377150 OperationalError: no such table: django_session

I didn't understand your comment about "...replay with 'no'". Do I need to do more than just run '/opt/stack/horizon/manage.py syncdb'?

Revision history for this message
Ekaterina Chernova (efedorova) said :
#5

that;s ptyhon, so

"python /opt/stack/horizon/manage.py syncdb"

Revision history for this message
Calum Loudon (calum-loudon) said :
#6

Makes no difference (the manage.py script has a '#!/usr/bin/env python' hashbang, so it was being executed as python anyway). Same output as above, horizon still doesn't work, same errors as before, unfortunately.

Revision history for this message
Ekaterina Chernova (efedorova) said :
#7

So, please change check the django settings file, located somewhere at /opt/stack/horizon/openstack_dashboard

and validate DATABASES parameter. You can change the path try run syncdb again: http://stackoverflow.com/questions/3631556/django-no-such-table-django-session

Revision history for this message
Calum Loudon (calum-loudon) said :
#8

/opt/stack/horizon/openstack_dashboard/settings.py has this as the only section containing DATABASES:

#MURANO_CONFIG_SECTION_BEGIN
#-------------------------------------------------------------------------------
METADATA_CACHE_DIR = '/tmp/murano'
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(METADATA_CACHE_DIR, 'openstack-dashboard.sqlite')
    }
}
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
MIDDLEWARE_CLASSES += ('muranodashboard.middleware.ExceptionMiddleware',)
#-------------------------------------------------------------------------------
#MURANO_CONFIG_SECTION_END

As above, /tmp/murano/openstack-dashboard.sqlite exists, and if I open it up using sqlite3 there is a django_session table (though it is empty):

[stack@kilo-control tmp]$ sqlite3 /tmp/murano/openstack-dashboard.sqlite
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
auth_group auth_user_groups
auth_group_permissions auth_user_user_permissions
auth_permission django_content_type
auth_user django_session
sqlite> select * from django_session;
sqlite> .quit

Revision history for this message
Ekaterina Chernova (efedorova) said :
#9

try to delete it and call syncdb again, try restart apache. everything looks correct

Revision history for this message
Calum Loudon (calum-loudon) said :
#10

Tried deleting & recreating. Asked me about creating a superuser, so tried the procedure twice, once creating a superuser (root/password), the other time not. Same result both times: the same "no such table: django_session" error.

I turned on debugging (local_settings.py: LOGGING['handlers']['console']['level'] INFO->DEBUG; commented out the explicit nulling of django.db.backends). That showed it was trying to issue these requests:

2015-06-16 10:37:49.327453 (0.000) QUERY = u'SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_date" FROM "django_session" WHERE ("django_session"."session_key" = %s AND "django_session"."expire_date" > %s ) LIMIT 21' - PARAMS = (u'.<long key snipped>:1Z4TOK:e-t2wMVTjleWBsADBlTLlbgc9zQ', u'2015-06-16 10:37:49.213862')

I then tried deleting /tmp/murano/openstack-dashboard.sqlite & restarting apache and got the same error as above. given the identical errors in the existing/not existing situations, and given the /tmp/murano/openstack-dashboard.sqlite file did have django_session in it when it existed, that suggested it was looking at a different .sqlite file somehow. Searching, I found one at /tmp/systemd-private-3BPuS0/tmp/murano/openstack-dashboard.sqlite. Examining it showed it was empty with no tables.

Tried deleting that, restarting Apache and re-running; I get the same error as above *and* there is a new openstack-dashboard.sqlite created at /tmp/systemd-private-HzHCyn/tmp/murano/openstack-dashboard.sqlite. Tried deleting that while leaving Apache running; attempting to log on then creates a further .sqlite under /tmp/systemd-private-xxxxxxx/tmp

This all suggests to me:

- /opt/stack/horizon/manage.py syncdb is creating the correct SQLite DB at /tmp/murano/openstack-dashboard.sqlite with a django.session table

- but Horizon/Murano is not using it

- instead, something in Horizon/Murano is creating on the fly an empty SQLite DB under a tmp/systemd-private/xxxxx directory and using that one instead.

Any ideas (and thanks for all the suggestions so far)?

Revision history for this message
Calum Loudon (calum-loudon) said :
#11

Have found the problem. I'm installing on CentOS 7 which uses systemd. The default config for httpd.service (in /usr/lib/systemd/system/httpd.service) has PrivateTmp set True, so code running in the context of Apache doesn't have access to the system /tmp but gets a private copy, hence the symptoms described above. Set it to False, restarted httpd and it all works.

I'll raise a bug to cover this.

Revision history for this message
Serg Melikyan (smelikyan) said :
#12

Thank you Calum!