Restart openstack-cinder-volume service

Change-Id: If675261076501557f1063e33163fc0e322feb5eb
Fixes: rhbz#975007
This commit is contained in:
Martin Magr 2013-06-17 18:22:08 +02:00
parent 65356a2f6e
commit 462527b1d3
1 changed files with 14 additions and 3 deletions

View File

@ -167,6 +167,14 @@ def check_cinder_vg():
return
server = utils.ScriptRunner(controller.CONF['CONFIG_CINDER_HOST'])
server.append('systemctl')
try:
server.execute()
rst_cmd = 'systemctl restart openstack-cinder-volume.service'
except ScriptRuntimeError:
rst_cmd = 'service openstack-cinder-volume restart'
server.clear()
logging.info("A new cinder volumes group will be created")
err = "Cinder's volume group '%s' could not be created" % \
cinders_volume
@ -185,9 +193,12 @@ def check_cinder_vg():
# Add the loop device on boot
server.append('grep %(volume)s /etc/rc.d/rc.local || '
'echo "losetup -f %(path)s && vgchange -a y %(volume)s" '
'>> /etc/rc.d/rc.local' % {'volume': cinders_volume,
'path': cinders_volume_path})
'echo "losetup -f %(path)s && '
'vgchange -a y %(volume)s && '
'%(restart_cmd)s" '
'>> /etc/rc.d/rc.local' %
{'volume': cinders_volume, 'restart_cmd': rst_cmd,
'path': cinders_volume_path})
server.append('grep "#!" /etc/rc.d/rc.local || '
'sed -i \'1i#!/bin/sh\' /etc/rc.d/rc.local')
server.append('chmod +x /etc/rc.d/rc.local')