Merge pull request #83 from lhrc-mikeyp/master

fix for issue #82
This commit is contained in:
Joshua Harlow 2012-03-13 15:18:25 -07:00
commit 4c1fa96788
2 changed files with 19 additions and 5 deletions

View File

@ -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']

View File

@ -82,10 +82,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"
@ -507,6 +519,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()
@ -541,7 +554,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.")