Merge "SIGSTOP/SIGCONT signals for RabbitMQ/MySQL/Keystone-API/Nova-API services"
This commit is contained in:
commit
e220f9198c
@ -136,6 +136,8 @@ class FuelService(service.Service):
|
||||
hosts=hosts)
|
||||
|
||||
def restart(self, nodes=None):
|
||||
if not getattr(self, 'RESTART_CMD'):
|
||||
raise NotImplementedError('RESTART_CMD is undefined')
|
||||
nodes = nodes or self.get_nodes()
|
||||
task_result = self._run_task({'command': self.RESTART_CMD}, nodes)
|
||||
logging.info('Restart %s, result: %s', str(self.__class__),
|
||||
@ -147,36 +149,109 @@ class FuelService(service.Service):
|
||||
logging.info('SIGKILL %s, result: %s', str(self.__class__),
|
||||
task_result)
|
||||
|
||||
def freeze(self, nodes=None, sec=None):
|
||||
nodes = nodes or self.get_nodes()
|
||||
cmd = self.FREEZE_SEC_CMD.format(sec) if sec else self.FREEZE_CMD
|
||||
task_result = self._run_task({'command': cmd}, nodes)
|
||||
logging.info('FREEZE({0}) {1}, result: {2}'.format(sec or '',
|
||||
self.__class__, task_result))
|
||||
|
||||
def unfreeze(self, nodes=None):
|
||||
nodes = nodes or self.get_nodes()
|
||||
task_result = self._run_task({'command': self.UNFREEZE_CMD}, nodes)
|
||||
logging.info('UNFREEZE %s, result: %s', str(self.__class__),
|
||||
task_result)
|
||||
|
||||
|
||||
class KeystoneService(FuelService):
|
||||
GET_NODES_CMD = 'bash -c "ps ax | grep \'keystone-main\'"'
|
||||
GET_NODES_CMD = 'bash -c "ps ax | grep \'[k]eystone-main\'"'
|
||||
KILL_CMD = ('bash -c "ps ax | grep [k]eystone'
|
||||
' | awk {\'print $1\'} | xargs kill -9"')
|
||||
RESTART_CMD = 'service apache2 restart'
|
||||
FREEZE_CMD = ('bash -c "ps ax | grep [k]eystone'
|
||||
' | awk {\'print $1\'} | xargs kill -19"')
|
||||
FREEZE_SEC_CMD = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);'
|
||||
'echo -n \'#!\' > $tf; '
|
||||
'echo -en \'/bin/bash\\npids=`ps ax | '
|
||||
'grep [k]eystone | awk {{\\047print $1\\047}}`; '
|
||||
'echo $pids | xargs kill -19; sleep {0}; '
|
||||
'echo $pids | xargs kill -18; rm \' >> $tf; '
|
||||
'echo -n $tf >> $tf; '
|
||||
'chmod 770 $tf; nohup $tf &"')
|
||||
UNFREEZE_CMD = ('bash -c "ps ax | grep [k]eystone'
|
||||
' | awk {\'print $1\'} | xargs kill -18"')
|
||||
|
||||
|
||||
class MySQLService(FuelService):
|
||||
GET_NODES_CMD = 'bash -c "netstat -tap | grep \'.*LISTEN.*mysqld\'"'
|
||||
KILL_CMD = ('bash -c "ps ax | grep [m]ysqld'
|
||||
' | awk {\'print $1\'} | xargs kill -9"')
|
||||
FREEZE_CMD = ('bash -c "ps ax | grep [m]ysqld'
|
||||
' | awk {\'print $1\'} | xargs kill -19"')
|
||||
FREEZE_SEC_CMD = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);'
|
||||
'echo -n \'#!\' > $tf; '
|
||||
'echo -en \'/bin/bash\\npids=`ps ax | '
|
||||
'grep [m]ysqld | awk {{\\047print $1\\047}}`; '
|
||||
'echo $pids | xargs kill -19; sleep {0}; '
|
||||
'echo $pids | xargs kill -18; rm \' >> $tf; '
|
||||
'echo -n $tf >> $tf; '
|
||||
'chmod 770 $tf; nohup $tf &"')
|
||||
UNFREEZE_CMD = ('bash -c "ps ax | grep [m]ysqld'
|
||||
' | awk {\'print $1\'} | xargs kill -18"')
|
||||
|
||||
|
||||
class RabbitMQService(FuelService):
|
||||
GET_NODES_CMD = 'bash -c "rabbitmqctl status | grep \'pid,\'"'
|
||||
KILL_CMD = ('bash -c "ps ax | grep [r]abbitmq-server'
|
||||
' | awk {\'print $1\'} | xargs kill -9"')
|
||||
FREEZE_CMD = ('bash -c "ps ax | grep [r]abbitmq-server'
|
||||
' | awk {\'print $1\'} | xargs kill -19"')
|
||||
FREEZE_SEC_CMD = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);'
|
||||
'echo -n \'#!\' > $tf; '
|
||||
'echo -en \'/bin/bash\\npids=`ps ax | '
|
||||
'grep [r]abbitmq-server | awk {{\\047print $1\\047}}`; '
|
||||
'echo $pids | xargs kill -19; sleep {0}; '
|
||||
'echo $pids | xargs kill -18; rm \' >> $tf; '
|
||||
'echo -n $tf >> $tf; '
|
||||
'chmod 770 $tf; nohup $tf &"')
|
||||
UNFREEZE_CMD = ('bash -c "ps ax | grep [r]abbitmq-server'
|
||||
' | awk {\'print $1\'} | xargs kill -18"')
|
||||
|
||||
|
||||
class NovaAPIService(FuelService):
|
||||
GET_NODES_CMD = 'bash -c "ps ax | grep \'nova-api\'"'
|
||||
GET_NODES_CMD = 'bash -c "ps ax | grep \'[n]ova-api\'"'
|
||||
KILL_CMD = ('bash -c "ps ax | grep [n]ova-api'
|
||||
' | awk {\'print $1\'} | xargs kill -9"')
|
||||
FREEZE_CMD = ('bash -c "ps ax | grep [n]ova-api'
|
||||
' | awk {\'print $1\'} | xargs kill -19"')
|
||||
FREEZE_SEC_CMD = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);'
|
||||
'echo -n \'#!\' > $tf; '
|
||||
'echo -en \'/bin/bash\\npids=`ps ax | '
|
||||
'grep [n]ova-api | awk {{\\047print $1\\047}}`; '
|
||||
'echo $pids | xargs kill -19; sleep {0}; '
|
||||
'echo $pids | xargs kill -18; rm \' >> $tf; '
|
||||
'echo -n $tf >> $tf; '
|
||||
'chmod 770 $tf; nohup $tf &"')
|
||||
UNFREEZE_CMD = ('bash -c "ps ax | grep [n]ova-api'
|
||||
' | awk {\'print $1\'} | xargs kill -18"')
|
||||
|
||||
|
||||
class GlanceAPIService(FuelService):
|
||||
GET_NODES_CMD = 'bash -c "ps ax | grep \'glance-api\'"'
|
||||
GET_NODES_CMD = 'bash -c "ps ax | grep \'[g]lance-api\'"'
|
||||
KILL_CMD = ('bash -c "ps ax | grep [g]lance-api'
|
||||
' | awk {\'print $1\'} | xargs kill -9"')
|
||||
FREEZE_CMD = ('bash -c "ps ax | grep [g]lance-api'
|
||||
' | awk {\'print $1\'} | xargs kill -19"')
|
||||
FREEZE_SEC_CMD = ('bash -c "tf=$(mktemp /tmp/script.XXXXXX);'
|
||||
'echo -n \'#!\' > $tf; '
|
||||
'echo -en \'/bin/bash\\npids=`ps ax | '
|
||||
'grep [g]lance-api | awk {{\\047print $1\\047}}`; '
|
||||
'echo $pids | xargs kill -19; sleep {0}; '
|
||||
'echo $pids | xargs kill -18; rm \' >> $tf; '
|
||||
'echo -n $tf >> $tf; '
|
||||
'chmod 770 $tf; nohup $tf &"')
|
||||
UNFREEZE_CMD = ('bash -c "ps ax | grep [g]lance-api'
|
||||
' | awk {\'print $1\'} | xargs kill -18"')
|
||||
|
||||
|
||||
SERVICE_NAME_TO_CLASS = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user