Fixes cinder-volume service startup on Windows

The Windows service fails due to missing non-blocking IO features
in eventlet. This fix adds a conditional path on Windows to execute
the service accordingly.

Fixes bug: #1219896

Change-Id: I74f662e736e3a5fe58a383d172780a691a2b36c7
This commit is contained in:
Lucian Petrut 2013-09-02 18:20:21 +03:00 committed by Petrut Lucian
parent c37b7db38a
commit 2f4e9b22b7
1 changed files with 13 additions and 4 deletions

View File

@ -20,10 +20,15 @@
"""Starter script for Cinder Volume."""
import eventlet
eventlet.monkey_patch()
import os
if os.name == 'nt':
# eventlet monkey patching the os module causes subprocess.Popen to fail
# on Windows when using pipes due to missing non-blocking IO support.
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
import sys
from oslo.config import cfg
@ -54,7 +59,11 @@ if __name__ == '__main__':
version=version.version_string())
logging.setup("cinder")
utils.monkey_patch()
launcher = service.ProcessLauncher()
if os.name == 'nt':
launcher = service
launcher.launch_server = service.serve
else:
launcher = service.ProcessLauncher()
if CONF.enabled_backends:
for backend in CONF.enabled_backends:
host = "%s@%s" % (CONF.host, backend)