Don't fork marconi-server unless USE_SCREEN=False
Marconi's server should be forked *just* when running under devstack and when USE_SCREEN is set to False. Change-Id: Id891c85b5719ef1bcd3b5ddf92a54d2b4fe3a34d Closes-bug: #1301268
This commit is contained in:
parent
43883fc9c4
commit
08841d1742
@ -34,26 +34,29 @@ def run():
|
|||||||
# want it to. This is specifically needed to allow marconi to
|
# want it to. This is specifically needed to allow marconi to
|
||||||
# run under devstack, but it may also be useful for other scenarios.
|
# run under devstack, but it may also be useful for other scenarios.
|
||||||
# Open /dev/zero and /dev/null for redirection.
|
# Open /dev/zero and /dev/null for redirection.
|
||||||
zerofd = os.open('/dev/zero', os.O_RDONLY)
|
# Daemonizing marconi-server is needed *just* when running under devstack
|
||||||
nullfd = os.open('/dev/null', os.O_WRONLY)
|
# and when `USE_SCREEN` is set to False.
|
||||||
|
if os.environ.get('USE_SCREEN', '').lower() == 'false':
|
||||||
|
zerofd = os.open('/dev/zero', os.O_RDONLY)
|
||||||
|
nullfd = os.open('/dev/null', os.O_WRONLY)
|
||||||
|
|
||||||
# Close the stdthings and reassociate them with a non terminal
|
# Close the stdthings and reassociate them with a non terminal
|
||||||
os.dup2(zerofd, 0)
|
os.dup2(zerofd, 0)
|
||||||
os.dup2(nullfd, 1)
|
os.dup2(nullfd, 1)
|
||||||
os.dup2(nullfd, 2)
|
os.dup2(nullfd, 2)
|
||||||
|
|
||||||
# Detach process context, this requires 2 forks.
|
# Detach process context, this requires 2 forks.
|
||||||
try:
|
try:
|
||||||
pid = os.fork()
|
pid = os.fork()
|
||||||
if pid > 0:
|
if pid > 0:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
except OSError:
|
except OSError:
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pid = os.fork()
|
pid = os.fork()
|
||||||
if pid > 0:
|
if pid > 0:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
except OSError:
|
except OSError:
|
||||||
os._exit(2)
|
os._exit(2)
|
||||||
server.run()
|
server.run()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user