Gracefull shutdown of nova-api.
This commit is contained in:
1
Authors
1
Authors
@@ -93,3 +93,4 @@ Yoshiaki Tamura <yoshi@midokura.jp>
|
|||||||
Youcef Laribi <Youcef.Laribi@eu.citrix.com>
|
Youcef Laribi <Youcef.Laribi@eu.citrix.com>
|
||||||
Yuriy Taraday <yorik.sar@gmail.com>
|
Yuriy Taraday <yorik.sar@gmail.com>
|
||||||
Zhixue Wu <Zhixue.Wu@citrix.com>
|
Zhixue Wu <Zhixue.Wu@citrix.com>
|
||||||
|
Nikolay Sokolov <nsokolov@griddynamics.com>
|
||||||
|
|||||||
12
bin/nova-api
12
bin/nova-api
@@ -24,6 +24,7 @@ Starts both the EC2 and OpenStack APIs in separate processes.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
|
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
|
||||||
@@ -34,6 +35,10 @@ if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
|
|||||||
import nova.service
|
import nova.service
|
||||||
import nova.utils
|
import nova.utils
|
||||||
|
|
||||||
|
def create_kill_handler(launcher):
|
||||||
|
def handle(signal, frame):
|
||||||
|
launcher.stop()
|
||||||
|
return handle
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Launch EC2 and OSAPI services."""
|
"""Launch EC2 and OSAPI services."""
|
||||||
@@ -46,10 +51,9 @@ def main():
|
|||||||
launcher.launch_service(ec2)
|
launcher.launch_service(ec2)
|
||||||
launcher.launch_service(osapi)
|
launcher.launch_service(osapi)
|
||||||
|
|
||||||
try:
|
signal.signal(signal.SIGTERM, create_kill_handler(launcher))
|
||||||
launcher.wait()
|
|
||||||
except KeyboardInterrupt:
|
launcher.wait()
|
||||||
launcher.stop()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user