From 6b7f6b547d08070bdd70ca298610b04511e35aa5 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 29 Feb 2012 11:09:47 -0800 Subject: [PATCH] First attempt at new horizon location moves/cleanups for e-4. --- conf/templates/horizon/000-default.tpl | 15 ++++---- .../templates/horizon/horizon_settings.py.tpl | 9 +++-- devstack/components/horizon.py | 34 +++++-------------- 3 files changed, 19 insertions(+), 39 deletions(-) diff --git a/conf/templates/horizon/000-default.tpl b/conf/templates/horizon/000-default.tpl index 219b7c0e..240cabeb 100644 --- a/conf/templates/horizon/000-default.tpl +++ b/conf/templates/horizon/000-default.tpl @@ -1,18 +1,17 @@ +#From commit b32c876ed5e66c8971c8126432c1ae957301eb08 of devstack.sh repo. +# +#With adjustments to make HORIZON_PORT, ERROR_LOG, ACCESS_LOG, VPN_DIR a param + - -#From commit 30439a6dc4 -#With adjustments to make APACHE_RUN_GROUP a param -#and to make HORIZON_PORT a param - - WSGIScriptAlias / %HORIZON_DIR%/openstack-dashboard/dashboard/wsgi/django.wsgi + WSGIScriptAlias / %HORIZON_DIR%/openstack_dashboard/wsgi/django.wsgi WSGIDaemonProcess horizon user=%USER% group=%GROUP% processes=3 threads=10 SetEnv APACHE_RUN_USER %USER% SetEnv APACHE_RUN_GROUP %GROUP% WSGIProcessGroup horizon DocumentRoot %HORIZON_DIR%/.blackhole/ - Alias /media %HORIZON_DIR%/openstack-dashboard/dashboard/static - Alias /vpn /opt/stack/vpn + Alias /media %HORIZON_DIR%/openstack_dashboard/static + Alias /vpn %VPN_DIR% Options FollowSymLinks diff --git a/conf/templates/horizon/horizon_settings.py.tpl b/conf/templates/horizon/horizon_settings.py.tpl index f7ef5aa5..fb7c90bd 100644 --- a/conf/templates/horizon/horizon_settings.py.tpl +++ b/conf/templates/horizon/horizon_settings.py.tpl @@ -1,4 +1,6 @@ -# Based off of horizon_settings.py from commit 7bd3087e73c0683acf5df40d1eed51709d865c06 +#From commit b32c876ed5e66c8971c8126432c1ae957301eb08 of devstack.sh repo. +# +#With adjustments to make OPENSTACK_HOST a param import os @@ -39,7 +41,7 @@ MAILER_EMAIL_BACKEND = EMAIL_BACKEND HORIZON_CONFIG = { 'dashboards': ('nova', 'syspanel', 'settings',), 'default_dashboard': 'nova', - 'user_home': 'dashboard.views.user_home', + 'user_home': 'openstack_dashboard.views.user_home', } OPENSTACK_HOST = "%OPENSTACK_HOST%" @@ -100,6 +102,3 @@ SWIFT_PAGINATE_LIMIT = 100 # } # } #} - -# How much ram on each compute host? -COMPUTE_HOST_RAM_GB = 16 diff --git a/devstack/components/horizon.py b/devstack/components/horizon.py index e7e3368e..155a3b1c 100644 --- a/devstack/components/horizon.py +++ b/devstack/components/horizon.py @@ -65,6 +65,9 @@ APACHE_RESTART_CMD = ['service', '%SERVICE%', 'restart'] APACHE_START_CMD = ['service', '%SERVICE%', 'start'] APACHE_STOP_CMD = ['service', '%SERVICE%', 'stop'] APACHE_STATUS_CMD = ['service', '%SERVICE%', 'status'] +APACHE_ERROR_LOG_FN = "error.log" +APACHE_ACCESS_LOG_FN = "access.log" +APACHE_DEF_PORT = 80 #rhel fixups #TODO: maybe this should be a subclass that handles these differences @@ -145,12 +148,6 @@ class HorizonInstaller(comp.PythonInstallComponent): else: return comp.PythonInstallComponent._get_target_config_name(self, config_name) - def _get_python_directories(self): - py_dirs = dict() - py_dirs[HORIZON_NAME] = self.horizon_dir - py_dirs[DASH_NAME] = self.dash_dir - return py_dirs - def _get_config_files(self): return list(CONFIGS) @@ -164,19 +161,6 @@ class HorizonInstaller(comp.PythonInstallComponent): LOG.info("Initializing the horizon database.") sh.execute(*DB_SYNC_CMD, cwd=self.dash_dir) - def _fake_quantum(self): - #Horizon currently imports quantum even if you aren't using it. - #Instead of installing quantum we can create a simple module - #that will pass the initial imports. - if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False): - return - else: - #Make the fake quantum - quantum_dir = sh.joinpths(self.dash_dir, 'quantum') - self.tracewriter.make_dir(quantum_dir) - self.tracewriter.touch_file(sh.joinpths(quantum_dir, '__init__.py')) - self.tracewriter.touch_file(sh.joinpths(quantum_dir, 'client.py')) - def _ensure_db_access(self): # ../openstack-dashboard/local needs to be writeable by the runtime user # since currently its storing the sql-lite databases there (TODO fix that) @@ -221,7 +205,6 @@ class HorizonInstaller(comp.PythonInstallComponent): def post_install(self): comp.PythonInstallComponent.post_install(self) - self._fake_quantum() self._sync_db() self._setup_blackhole() self._ensure_db_access() @@ -242,15 +225,14 @@ class HorizonInstaller(comp.PythonInstallComponent): mp = dict() if config_fn == HORIZON_APACHE_CONF: (user, group) = self._get_apache_user_group() - mp['USER'] = user + mp['ACCESS_LOG'] = sh.joinpths(self.log_dir, APACHE_ACCESS_LOG_FN) + mp['ERROR_LOG'] = sh.joinpths(self.log_dir, APACHE_ERROR_LOG_FN) mp['GROUP'] = group mp['HORIZON_DIR'] = self.appdir - mp['HORIZON_PORT'] = self.cfg.getdefaulted('horizon', 'port', 80) - mp['ACCESS_LOG'] = sh.joinpths(self.log_dir, "access.log") - mp['ERROR_LOG'] = sh.joinpths(self.log_dir, "error.log") + mp['HORIZON_PORT'] = self.cfg.getdefaulted('horizon', 'port', APACHE_DEF_PORT) + mp['USER'] = user + mp['VPN_DIR'] = sh.joinpths(self.appdir, "vpn") else: - #Enable quantum in dashboard, if requested - mp['QUANTUM_ENABLED'] = "%s" % (utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False)) mp['OPENSTACK_HOST'] = self.cfg.get('host', 'ip') return mp