Remove deprecated cyborg.image.download.modules

This was deprecated from Queens. Remove it before we clean up the
image download code.

Change-Id: Ic765a2958f7a00f7b2bb6fb580dda064094817b4
changes/44/736844/3
Monty Taylor 2 years ago
parent 8826575689
commit 9b99e56c67
  1. 23
      cyborg/conf/glance.py
  2. 6
      cyborg/image/api.py
  3. 54
      cyborg/image/download/__init__.py
  4. 35
      cyborg/image/glance.py
  5. 7
      releasenotes/notes/removed-download-modules-540fa0607d7df967.yaml

@ -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,

@ -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

@ -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

@ -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:

@ -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.
Loading…
Cancel
Save