diff --git a/doc/source/admin/requirements.rst b/doc/source/admin/requirements.rst index 87701e2c7f..30c5878cdc 100644 --- a/doc/source/admin/requirements.rst +++ b/doc/source/admin/requirements.rst @@ -26,10 +26,6 @@ of its features. Some examples include the ``qemu-img`` utility used by the tasks feature, ``pydev`` to debug using popular IDEs, ``python-xattr`` for Image Cache using "xattr" driver. -Additionally, some libraries like ``xattr`` are not compatible when -using Glance on Windows (see :ref:`the documentation on config options -affecting the Image Cache `). - Guideline to include your requirement in the requirements.txt file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/source/configuration/configuring.rst b/doc/source/configuration/configuring.rst index 34ff33c02f..c3159dd118 100644 --- a/doc/source/configuration/configuring.rst +++ b/doc/source/configuration/configuring.rst @@ -1756,8 +1756,7 @@ One main configuration file option affects the image cache. and requires that the filesystem containing ``image_cache_dir`` have access times tracked for all files (in other words, the noatime option CANNOT be set for that filesystem). In addition, ``user_xattr`` must be - set on the filesystem's description line in fstab. Because of these - requirements, the ``xattr`` cache driver is not available on Windows. + set on the filesystem's description line in fstab. ``image_cache_sqlite_db=DB_FILE`` Optional. diff --git a/glance/cmd/api.py b/glance/cmd/api.py index 7cc3a61a66..abeaeb663f 100644 --- a/glance/cmd/api.py +++ b/glance/cmd/api.py @@ -25,13 +25,7 @@ import os import sys import eventlet - -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.patcher.monkey_patch(os=False) -else: - eventlet.patcher.monkey_patch() +eventlet.patcher.monkey_patch() # Monkey patch the original current_thread to use the up-to-date _active # global variable. See https://bugs.launchpad.net/bugs/1863021 and @@ -66,7 +60,6 @@ from glance import version CONF = cfg.CONF CONF.import_group("profiler", "glance.common.wsgi") logging.register_options(CONF) -wsgi.register_cli_opts() # NOTE(rosmaita): Any new exceptions added should preserve the current # error codes for backward compatibility. The value 99 is returned diff --git a/glance/cmd/scrubber.py b/glance/cmd/scrubber.py index 09e1928066..be64e105e7 100644 --- a/glance/cmd/scrubber.py +++ b/glance/cmd/scrubber.py @@ -23,13 +23,7 @@ import os import sys import eventlet - -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.patcher.monkey_patch(os=False) -else: - eventlet.patcher.monkey_patch() +eventlet.patcher.monkey_patch() # Monkey patch the original current_thread to use the up-to-date _active # global variable. See https://bugs.launchpad.net/bugs/1863021 and @@ -49,7 +43,6 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): sys.path.insert(0, possible_topdir) import glance_store -from os_win import utilsfactory as os_win_utilsfactory from oslo_config import cfg from oslo_log import log as logging @@ -64,18 +57,7 @@ CONF.set_default(name='use_stderr', default=True) def main(): - # Used on Window, ensuring that a single scrubber can run at a time. - mutex = None - mutex_acquired = False - try: - if os.name == 'nt': - # We can't rely on process names on Windows as there may be - # wrappers with the same name. - mutex = os_win_utilsfactory.get_mutex( - name='Global\\glance-scrubber') - mutex_acquired = mutex.acquire(timeout_ms=0) - CONF.register_cli_opts(scrubber.scrubber_cmd_cli_opts) CONF.register_opts(scrubber.scrubber_cmd_opts) @@ -99,12 +81,7 @@ def main(): app = scrubber.Scrubber(glance_store) if CONF.restore: - if os.name == 'nt': - scrubber_already_running = not mutex_acquired - else: - scrubber_already_running = scrubber_already_running_posix() - - if scrubber_already_running: + if scrubber_already_running(): already_running_msg = ( "ERROR: glance-scrubber is already running. " "Please ensure that the daemon is stopped.") @@ -121,12 +98,9 @@ def main(): sys.exit("ERROR: %s" % e) except RuntimeError as e: sys.exit("ERROR: %s" % e) - finally: - if mutex and mutex_acquired: - mutex.release() -def scrubber_already_running_posix(): +def scrubber_already_running(): # Try to check the glance-scrubber is running or not. # 1. Try to find the pid file if scrubber is controlled by # glance-control diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 21e42bbfa9..80ec4bd069 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -24,10 +24,7 @@ import abc import errno import functools import os -import re import signal -import struct -import subprocess import sys import time @@ -35,7 +32,6 @@ from eventlet.green import socket import eventlet.greenio import eventlet.wsgi import glance_store -from os_win import utilsfactory as os_win_utilsfactory from oslo_concurrency import processutils from oslo_config import cfg from oslo_log import log as logging @@ -252,13 +248,6 @@ store_opts = [ 'using comma.')), ] -cli_opts = [ - cfg.StrOpt('pipe-handle', - help='This argument is used internally on Windows. Glance ' - 'passes a pipe handle to child processes, which is then ' - 'used for inter-process communication.'), -] - LOG = logging.getLogger(__name__) @@ -286,17 +275,9 @@ RESERVED_STORES = { } -def register_cli_opts(): - CONF.register_cli_opts(cli_opts) - - def get_num_workers(): """Return the configured number of workers.""" - # Windows only: we're already running on the worker side. - if os.name == 'nt' and getattr(CONF, 'pipe_handle', None): - return 0 - if CONF.workers is None: # None implies the number of CPUs limited to 8 # See Launchpad bug #1748916 and the config help text @@ -740,125 +721,7 @@ class PosixServer(BaseServer): self.start_wsgi() -class Win32ProcessLauncher(object): - def __init__(self): - self._processutils = os_win_utilsfactory.get_processutils() - - self._workers = [] - self._worker_job_handles = [] - - def add_process(self, cmd): - LOG.info("Starting subprocess: %s", cmd) - - worker = subprocess.Popen(cmd, close_fds=False) - try: - job_handle = self._processutils.kill_process_on_job_close( - worker.pid) - except Exception: - LOG.exception("Could not associate child process " - "with a job, killing it.") - worker.kill() - raise - - self._worker_job_handles.append(job_handle) - self._workers.append(worker) - - return worker - - def wait(self): - pids = [worker.pid for worker in self._workers] - if pids: - self._processutils.wait_for_multiple_processes(pids, - wait_all=True) - # By sleeping here, we allow signal handlers to be executed. - time.sleep(0) - - -class Win32Server(BaseServer): - _py_script_re = re.compile(r'.*\.py\w?$') - _sock = None - - def __init__(self, *args, **kwargs): - LOG.warning("Support for Glance on Windows operating systems is" - "deprecated.") - super(Win32Server, self).__init__(*args, **kwargs) - self._launcher = Win32ProcessLauncher() - self._ioutils = os_win_utilsfactory.get_ioutils() - - def run_child(self): - # We're passing copies of the socket through pipes. - rfd, wfd = self._ioutils.create_pipe(inherit_handle=True) - - cmd = sys.argv + ['--pipe-handle=%s' % int(rfd)] - # Recent setuptools versions will trim '-script.py' and '.exe' - # extensions from sys.argv[0]. - if self._py_script_re.match(sys.argv[0]): - cmd = [sys.executable] + cmd - - worker = self._launcher.add_process(cmd) - self._ioutils.close_handle(rfd) - - share_sock_buff = self._sock.share(worker.pid) - self._ioutils.write_file( - wfd, - struct.pack('=0.2.1 # Apache-2.0 # timeutils iso8601>=0.1.11 # MIT -os-win>=4.0.1 # Apache-2.0 - castellan>=0.17.0 # Apache-2.0