diff --git a/cyborg/conf/glance.py b/cyborg/conf/glance.py index b8e41feb..0a9b9299 100644 --- a/cyborg/conf/glance.py +++ b/cyborg/conf/glance.py @@ -34,29 +34,6 @@ Enable glance operation retries. Specifies the number of retries when uploading / downloading an image to / from glance. 0 means no retries. -"""), - cfg.ListOpt('allowed_direct_url_schemes', - default=[], - deprecated_for_removal=True, - deprecated_since='17.0.0', - deprecated_reason=""" -This was originally added for the 'cyborg.image.download.file' FileTransfer -extension which was removed in the 16.0.0 Pike release. The -'cyborg.image.download.modules' extension point is not maintained -and there is no indication of its use in production clouds. -""", - help=""" -List of url schemes that can be directly accessed. - -This option specifies a list of url schemes that can be downloaded -directly via the direct_url. This direct_URL can be fetched from -Image metadata which can be used by cyborg to get the -image more efficiently. cyborg-compute could benefit from this by -invoking a copy when it has access to the same file system as glance. - -Possible values: - -* [file], Empty list (default) """), cfg.BoolOpt('verify_glance_signatures', default=False, diff --git a/cyborg/image/api.py b/cyborg/image/api.py index dbb8976e..7aa79039 100644 --- a/cyborg/image/api.py +++ b/cyborg/image/api.py @@ -149,11 +149,7 @@ class API(object): again, None is returned from the method. If no data argument is supplied and no dest_path argument is supplied (VMWare and XenAPI virt drivers), then the method returns an iterator to the image bits that - the caller uses to write to wherever location it wants. Finally, if the - allow_direct_url_schemes CONF option is set to something, then the - cyborg.image.download modules are used to attempt to do an SCP copy of - the image bits from a file location to the dest_path and None is - returned after retrying one or more download locations. + the caller uses to write to wherever location it wants. I think the above points to just how hacky/wacky all of this code is, and the reason it needs to be cleaned up and standardized across the diff --git a/cyborg/image/download/__init__.py b/cyborg/image/download/__init__.py deleted file mode 100644 index b674f80d..00000000 --- a/cyborg/image/download/__init__.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2013 Red Hat, Inc. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_log import log as logging -import stevedore.driver -import stevedore.extension - -LOG = logging.getLogger(__name__) - - -def load_transfer_modules(): - - module_dictionary = {} - - ex = stevedore.extension.ExtensionManager('cyborg.image.download.modules') - for module_name in ex.names(): - mgr = stevedore.driver.DriverManager( - namespace='cyborg.image.download.modules', - name=module_name, - invoke_on_load=False) - - schemes_list = mgr.driver.get_schemes() - for scheme in schemes_list: - if scheme in module_dictionary: - LOG.error('%(scheme)s is registered as a module twice. ' - '%(module_name)s is not being used.', - {'scheme': scheme, - 'module_name': module_name}) - else: - module_dictionary[scheme] = mgr.driver - - if module_dictionary: - LOG.warning('The cyborg.image.download.modules extension point is ' - 'deprecated for removal starting in the 17.0.0 Queens ' - 'release and may be removed as early as the 18.0.0 Rocky ' - 'release. It is not maintained and there is no indication ' - 'of its use in production clouds. If you are using this ' - 'extension point, please make the cyborg development team ' - 'aware by contacting us in the #openstack-cyborg freenode ' - 'IRC channel or on the openstack-dev mailing list.') - - return module_dictionary diff --git a/cyborg/image/glance.py b/cyborg/image/glance.py index 1b8a7588..fe8a6a46 100644 --- a/cyborg/image/glance.py +++ b/cyborg/image/glance.py @@ -36,12 +36,10 @@ from oslo_utils import excutils from oslo_utils import timeutils import six from six.moves import range -import six.moves.urllib.parse as urlparse from cyborg.common import exception from cyborg.common import utils import cyborg.conf -import cyborg.image.download as image_xfers from cyborg import objects from cyborg import service_auth @@ -187,24 +185,6 @@ class GlanceImageServiceV2(object): def __init__(self, client=None): self._client = client or GlanceClientWrapper() - # NOTE(jbresnah) build the table of download handlers at the beginning - # so that operators can catch errors at load time rather than whenever - # a user attempts to use a module. Note this cannot be done in glance - # space when this python module is loaded because the download module - # may require configuration options to be parsed. - self._download_handlers = {} - download_modules = image_xfers.load_transfer_modules() - - for scheme, mod in download_modules.items(): - if scheme not in CONF.glance.allowed_direct_url_schemes: - continue - - try: - self._download_handlers[scheme] = mod.get_download_handler() - except Exception as ex: - LOG.error('When loading the module %(module_str)s the ' - 'following error occurred: %(ex)s', - {'module_str': str(mod), 'ex': ex}) @staticmethod def _safe_fsync(fh): @@ -234,21 +214,6 @@ class GlanceImageServiceV2(object): def download(self, context, image_id, data=None, dst_path=None): """Calls out to Glance for data and writes data.""" - if CONF.glance.allowed_direct_url_schemes and dst_path is not None: - image = self.show(context, image_id, include_locations=True) - for entry in image.get('locations', []): - loc_url = entry['url'] - loc_meta = entry['metadata'] - o = urlparse.urlparse(loc_url) - xfer_mod = self._get_transfer_module(o.scheme) - if xfer_mod: - try: - xfer_mod.download(context, o, dst_path, loc_meta) - LOG.info("Successfully transferred using %s", o.scheme) - return - except Exception: - LOG.exception("Download image error") - try: image_chunks = self._client.call(context, 2, 'data', image_id) except Exception: diff --git a/releasenotes/notes/removed-download-modules-540fa0607d7df967.yaml b/releasenotes/notes/removed-download-modules-540fa0607d7df967.yaml new file mode 100644 index 00000000..4034e6d5 --- /dev/null +++ b/releasenotes/notes/removed-download-modules-540fa0607d7df967.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + ``cyborg.image.download.modules`` extension point and support + for ``allow_direct_url_schemes`` configuration setting, which + have been deprecated since the Queens release, have been + removed.