From d37cd693a019a4fc5217ded8c3948c4ac08ec90e Mon Sep 17 00:00:00 2001 From: Mike Pittaro Date: Tue, 13 Mar 2012 15:06:58 -0700 Subject: [PATCH] Fix issue #82 : stack failure after creating nova volumes Makes the icsi service restart platform dependent, adding fedora 16 and rhel support. Also adds a missing Fedora 16 apache service name. --- devstack/components/horizon.py | 1 + devstack/components/nova.py | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/devstack/components/horizon.py b/devstack/components/horizon.py index 4060cbc0..e5167041 100644 --- a/devstack/components/horizon.py +++ b/devstack/components/horizon.py @@ -59,6 +59,7 @@ BLACKHOLE_DIR = '.blackhole' #TODO: maybe this should be a subclass that handles these differences APACHE_SVC_NAME = { settings.RHEL6: 'httpd', + settings.FEDORA16: 'httpd', settings.UBUNTU11: 'apache2', } APACHE_RESTART_CMD = ['service', '%SERVICE%', 'restart'] diff --git a/devstack/components/nova.py b/devstack/components/nova.py index 104d9adf..da63e786 100644 --- a/devstack/components/nova.py +++ b/devstack/components/nova.py @@ -83,10 +83,22 @@ VG_LVREMOVE_CMD = [ {'cmd': ['lvremove', '-f', '%VOLUME_GROUP%/%LV%'], 'run_as_root': True} ] -RESTART_TGT_CMD = [ - {'cmd': ['stop', 'tgt'], 'run_as_root': True}, - {'cmd': ['start', 'tgt'], 'run_as_root': True} -] + +# iscsi restart commands +RESTART_TGT_CMD = { + settings.UBUNTU11: [ + {'cmd': ['stop', 'tgt'], 'run_as_root': True}, + {'cmd': ['start', 'tgt'], 'run_as_root': True} + ], + settings.RHEL6: [ + {'cmd': ['service', 'tgtd', 'stop'], 'run_as_root': True}, + {'cmd': ['service', 'tgtd', 'start'], 'run_as_root': True} + ], + settings.FEDORA16: [ + {'cmd': ['service', 'tgtd', 'stop'], 'run_as_root': True}, + {'cmd': ['service', 'tgtd', 'start'], 'run_as_root': True} + ], +} # NCPU, NVOL, NAPI ... are here as possible subcomponents of nova NCPU = "cpu" @@ -508,6 +520,7 @@ class NovaVolumeConfigurator(object): def __init__(self, ni): self.cfg = ni.cfg self.appdir = ni.appdir + self.distro = ni.distro def setup_volumes(self): self._setup_vol_groups() @@ -542,7 +555,7 @@ class NovaVolumeConfigurator(object): # logical volumes self._process_lvs(mp) # Finish off by restarting tgt, and ignore any errors - utils.execute_template(*RESTART_TGT_CMD, check_exit_code=False) + utils.execute_template(*RESTART_TGT_CMD[self.distro], check_exit_code=False) def _process_lvs(self, mp): LOG.info("Attempting to setup logical volumes for nova volume management.")