Browse Source

Merge "Rename async package to async_"

tags/18.0.0.0b1
Zuul 8 months ago
parent
commit
070179948b
35 changed files with 66 additions and 65 deletions
  1. 5
    5
      doc/source/admin/interoperable-image-import.rst
  2. 0
    0
      glance/async_/__init__.py
  3. 0
    0
      glance/async_/flows/__init__.py
  4. 0
    0
      glance/async_/flows/_internal_plugins/__init__.py
  5. 0
    0
      glance/async_/flows/_internal_plugins/web_download.py
  6. 2
    2
      glance/async_/flows/api_image_import.py
  7. 1
    1
      glance/async_/flows/base_import.py
  8. 0
    0
      glance/async_/flows/convert.py
  9. 1
    1
      glance/async_/flows/introspect.py
  10. 0
    0
      glance/async_/flows/ovf_process.py
  11. 0
    0
      glance/async_/flows/plugins/__init__.py
  12. 1
    1
      glance/async_/flows/plugins/image_conversion.py
  13. 0
    0
      glance/async_/flows/plugins/inject_image_metadata.py
  14. 0
    0
      glance/async_/flows/plugins/no_op.py
  15. 4
    4
      glance/async_/flows/plugins/plugin_opts.py
  16. 2
    2
      glance/async_/taskflow_executor.py
  17. 0
    0
      glance/async_/utils.py
  18. 1
    1
      glance/common/utils.py
  19. 1
    1
      glance/domain/__init__.py
  20. 10
    9
      glance/opts.py
  21. 0
    0
      glance/tests/unit/async_/__init__.py
  22. 0
    0
      glance/tests/unit/async_/flows/__init__.py
  23. 0
    0
      glance/tests/unit/async_/flows/plugins/__init__.py
  24. 1
    1
      glance/tests/unit/async_/flows/plugins/test_inject_image_metadata.py
  25. 2
    2
      glance/tests/unit/async_/flows/test_api_image_import.py
  26. 2
    2
      glance/tests/unit/async_/flows/test_convert.py
  27. 3
    3
      glance/tests/unit/async_/flows/test_import.py
  28. 2
    2
      glance/tests/unit/async_/flows/test_introspect.py
  29. 1
    1
      glance/tests/unit/async_/flows/test_ovf_process.py
  30. 1
    1
      glance/tests/unit/async_/flows/test_web_download.py
  31. 6
    6
      glance/tests/unit/async_/test_async.py
  32. 1
    1
      glance/tests/unit/async_/test_taskflow_executor.py
  33. 7
    7
      glance/tests/unit/test_domain.py
  34. 3
    3
      glance/tests/unit/test_notifier.py
  35. 9
    9
      setup.cfg

+ 5
- 5
doc/source/admin/interoperable-image-import.rst View File

@@ -243,17 +243,17 @@ specified in the ``glance-image-import.conf`` file.  The plugins are loaded by
243 243
 the Glance project team, these are already registered for you.)
244 244
 
245 245
 A plugin must be written in Python as a `Taskflow "Task" object`_.  The file
246
-containing this object must be present in the ``glance/async/flows/plugins``
246
+containing this object must be present in the ``glance/async_/flows/plugins``
247 247
 directory.  The plugin file must contain a ``get_flow`` function that returns a
248 248
 Taskflow Task object wrapped in a linear flow.  See the ``no_op`` plugin,
249
-located at ``glance/async/flows/plugins/no_op.py`` for an example of how to do
249
+located at ``glance/async_/flows/plugins/no_op.py`` for an example of how to do
250 250
 this.
251 251
 
252 252
 Specifying the plugins to be used
253 253
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254 254
 
255 255
 First, the plugin code must exist in the directory
256
-``glance/async/flows/plugins``.  The name of a plugin is the filename (without
256
+``glance/async_/flows/plugins``.  The name of a plugin is the filename (without
257 257
 extension) of the file containing the plugin code.  For example, a file named
258 258
 ``fred_mertz.py`` would contain the plugin ``fred_mertz``.
259 259
 
@@ -269,7 +269,7 @@ of the form::
269 269
 
270 270
 For example::
271 271
 
272
-  no_op = glance.async.flows.plugins.no_op:get_flow
272
+  no_op = glance.async_.flows.plugins.no_op:get_flow
273 273
 
274 274
 Make sure any plugin you want to use is included here.
275 275
 
@@ -337,7 +337,7 @@ required.
337 337
    The first section, ``image_import_opts``, is used to enable the plugin by
338 338
    specifying the plugin name as one of the elements of the list that is the
339 339
    value of the `image_import_plugins` parameter.  The plugin name is simply
340
-   the module name under glance/async/flows/plugins/
340
+   the module name under glance/async\_/flows/plugins/
341 341
 
342 342
    The second section, ``inject_metadata_properties``, is where you set the
343 343
    parameters for the injection plugin.  (Note that the values you specify here

glance/async/__init__.py → glance/async_/__init__.py View File


glance/async/flows/__init__.py → glance/async_/flows/__init__.py View File


glance/async/flows/_internal_plugins/__init__.py → glance/async_/flows/_internal_plugins/__init__.py View File


glance/async/flows/_internal_plugins/web_download.py → glance/async_/flows/_internal_plugins/web_download.py View File


glance/async/flows/api_image_import.py → glance/async_/flows/api_image_import.py View File

@@ -23,8 +23,8 @@ from taskflow.patterns import linear_flow as lf
23 23
 from taskflow import retry
24 24
 from taskflow import task
25 25
 
26
-import glance.async.flows._internal_plugins as internal_plugins
27
-import glance.async.flows.plugins as import_plugins
26
+import glance.async_.flows._internal_plugins as internal_plugins
27
+import glance.async_.flows.plugins as import_plugins
28 28
 from glance.common import exception
29 29
 from glance.common.scripts.image_import import main as image_import
30 30
 from glance.common.scripts import utils as script_utils

glance/async/flows/base_import.py → glance/async_/flows/base_import.py View File

@@ -30,7 +30,7 @@ from taskflow import retry
30 30
 from taskflow import task
31 31
 from taskflow.types import failure
32 32
 
33
-from glance.async import utils
33
+from glance.async_ import utils
34 34
 from glance.common import exception
35 35
 from glance.common.scripts.image_import import main as image_import
36 36
 from glance.common.scripts import utils as script_utils

glance/async/flows/convert.py → glance/async_/flows/convert.py View File


glance/async/flows/introspect.py → glance/async_/flows/introspect.py View File

@@ -21,7 +21,7 @@ from oslo_utils import encodeutils
21 21
 from oslo_utils import excutils
22 22
 from taskflow.patterns import linear_flow as lf
23 23
 
24
-from glance.async import utils
24
+from glance.async_ import utils
25 25
 from glance.i18n import _LE
26 26
 
27 27
 

glance/async/flows/ovf_process.py → glance/async_/flows/ovf_process.py View File


glance/async/flows/plugins/__init__.py → glance/async_/flows/plugins/__init__.py View File


glance/async/flows/plugins/image_conversion.py → glance/async_/flows/plugins/image_conversion.py View File

@@ -24,7 +24,7 @@ from oslo_utils import excutils
24 24
 from taskflow.patterns import linear_flow as lf
25 25
 from taskflow import task
26 26
 
27
-from glance.async import utils
27
+from glance.async_ import utils
28 28
 from glance.i18n import _
29 29
 
30 30
 LOG = logging.getLogger(__name__)

glance/async/flows/plugins/inject_image_metadata.py → glance/async_/flows/plugins/inject_image_metadata.py View File


glance/async/flows/plugins/no_op.py → glance/async_/flows/plugins/no_op.py View File


glance/async/flows/plugins/plugin_opts.py → glance/async_/flows/plugins/plugin_opts.py View File

@@ -14,8 +14,8 @@
14 14
 # under the License.
15 15
 
16 16
 
17
-import glance.async.flows.plugins.image_conversion
18
-import glance.async.flows.plugins.inject_image_metadata
17
+import glance.async_.flows.plugins.image_conversion
18
+import glance.async_.flows.plugins.inject_image_metadata
19 19
 
20 20
 
21 21
 # Note(jokke): This list contains tuples of config options for import plugins.
@@ -27,9 +27,9 @@ import glance.async.flows.plugins.inject_image_metadata
27 27
 # registered under at the config file.
28 28
 PLUGIN_OPTS = [
29 29
     ('inject_metadata_properties',
30
-     glance.async.flows.plugins.inject_image_metadata.inject_metadata_opts),
30
+     glance.async_.flows.plugins.inject_image_metadata.inject_metadata_opts),
31 31
     ('image_conversion',
32
-     glance.async.flows.plugins.image_conversion.conversion_plugin_opts),
32
+     glance.async_.flows.plugins.image_conversion.conversion_plugin_opts),
33 33
 ]
34 34
 
35 35
 

glance/async/taskflow_executor.py → glance/async_/taskflow_executor.py View File

@@ -23,7 +23,7 @@ from stevedore import driver
23 23
 from taskflow import engines
24 24
 from taskflow.listeners import logging as llistener
25 25
 
26
-import glance.async
26
+import glance.async_
27 27
 from glance.common import exception
28 28
 from glance.common.scripts import utils as script_utils
29 29
 from glance.i18n import _, _LE
@@ -85,7 +85,7 @@ CONF = cfg.CONF
85 85
 CONF.register_opts(taskflow_executor_opts, group='taskflow_executor')
86 86
 
87 87
 
88
-class TaskExecutor(glance.async.TaskExecutor):
88
+class TaskExecutor(glance.async_.TaskExecutor):
89 89
 
90 90
     def __init__(self, context, task_repo, image_repo, image_factory):
91 91
         self.context = context

glance/async/utils.py → glance/async_/utils.py View File


+ 1
- 1
glance/common/utils.py View File

@@ -128,7 +128,7 @@ def cooperative_read(fd):
128 128
 MAX_COOP_READER_BUFFER_SIZE = 134217728  # 128M seems like a sane buffer limit
129 129
 
130 130
 CONF.import_group('import_filtering_opts',
131
-                  'glance.async.flows._internal_plugins')
131
+                  'glance.async_.flows._internal_plugins')
132 132
 
133 133
 
134 134
 def validate_import_uri(uri):

+ 1
- 1
glance/domain/__init__.py View File

@@ -513,7 +513,7 @@ class TaskExecutorFactory(object):
513 513
                     TaskExecutorFactory.eventlet_deprecation_warned = True
514 514
                 task_executor = 'taskflow'
515 515
 
516
-            executor_cls = ('glance.async.%s_executor.'
516
+            executor_cls = ('glance.async_.%s_executor.'
517 517
                             'TaskExecutor' % task_executor)
518 518
             LOG.debug("Loading %s executor", task_executor)
519 519
             executor = importutils.import_class(executor_cls)

+ 10
- 9
glance/opts.py View File

@@ -28,11 +28,11 @@ from osprofiler import opts as profiler
28 28
 
29 29
 import glance.api.middleware.context
30 30
 import glance.api.versions
31
-import glance.async.flows._internal_plugins
32
-import glance.async.flows.api_image_import
33
-import glance.async.flows.convert
34
-from glance.async.flows.plugins import plugin_opts
35
-import glance.async.taskflow_executor
31
+import glance.async_.flows._internal_plugins
32
+import glance.async_.flows.api_image_import
33
+import glance.async_.flows.convert
34
+from glance.async_.flows.plugins import plugin_opts
35
+import glance.async_.taskflow_executor
36 36
 import glance.common.config
37 37
 import glance.common.location_strategy
38 38
 import glance.common.location_strategy.store_type
@@ -71,8 +71,8 @@ _api_opts = [
71 71
     ('image_format', glance.common.config.image_format_opts),
72 72
     ('task', glance.common.config.task_opts),
73 73
     ('taskflow_executor', list(itertools.chain(
74
-        glance.async.taskflow_executor.taskflow_executor_opts,
75
-        glance.async.flows.convert.convert_task_opts))),
74
+        glance.async_.taskflow_executor.taskflow_executor_opts,
75
+        glance.async_.flows.convert.convert_task_opts))),
76 76
     ('store_type_location_strategy',
77 77
      glance.common.location_strategy.store_type.store_type_opts),
78 78
     profiler.list_opts()[0],
@@ -109,9 +109,10 @@ _manage_opts = [
109 109
     (None, [])
110 110
 ]
111 111
 _image_import_opts = [
112
-    ('image_import_opts', glance.async.flows.api_image_import.api_import_opts),
112
+    ('image_import_opts',
113
+     glance.async_.flows.api_image_import.api_import_opts),
113 114
     ('import_filtering_opts',
114
-     glance.async.flows._internal_plugins.import_filtering_opts),
115
+     glance.async_.flows._internal_plugins.import_filtering_opts),
115 116
 ]
116 117
 
117 118
 

glance/tests/unit/async/__init__.py → glance/tests/unit/async_/__init__.py View File


glance/tests/unit/async/flows/__init__.py → glance/tests/unit/async_/flows/__init__.py View File


glance/tests/unit/async/flows/plugins/__init__.py → glance/tests/unit/async_/flows/plugins/__init__.py View File


glance/tests/unit/async/flows/plugins/test_inject_image_metadata.py → glance/tests/unit/async_/flows/plugins/test_inject_image_metadata.py View File

@@ -19,7 +19,7 @@ import os
19 19
 import glance_store
20 20
 from oslo_config import cfg
21 21
 
22
-import glance.async.flows.plugins.inject_image_metadata as inject_metadata
22
+import glance.async_.flows.plugins.inject_image_metadata as inject_metadata
23 23
 from glance.common import utils
24 24
 from glance import domain
25 25
 from glance import gateway

glance/tests/unit/async/flows/test_api_image_import.py → glance/tests/unit/async_/flows/test_api_image_import.py View File

@@ -17,7 +17,7 @@ import mock
17 17
 
18 18
 from oslo_config import cfg
19 19
 
20
-import glance.async.flows.api_image_import as import_flow
20
+import glance.async_.flows.api_image_import as import_flow
21 21
 import glance.tests.utils as test_utils
22 22
 
23 23
 CONF = cfg.CONF
@@ -52,7 +52,7 @@ class TestApiImageImportTask(test_utils.BaseTestCase):
52 52
         self.mock_task_repo = mock.MagicMock()
53 53
         self.mock_image_repo = mock.MagicMock()
54 54
 
55
-    @mock.patch('glance.async.flows.api_image_import._VerifyStaging.__init__')
55
+    @mock.patch('glance.async_.flows.api_image_import._VerifyStaging.__init__')
56 56
     @mock.patch('taskflow.patterns.linear_flow.Flow.add')
57 57
     @mock.patch('taskflow.patterns.linear_flow.__init__')
58 58
     def _pass_uri(self, mock_lf_init, mock_flow_add, mock_VS_init,

glance/tests/unit/async/flows/test_convert.py → glance/tests/unit/async_/flows/test_convert.py View File

@@ -22,8 +22,8 @@ from oslo_concurrency import processutils
22 22
 from oslo_config import cfg
23 23
 import six
24 24
 
25
-from glance.async.flows import convert
26
-from glance.async import taskflow_executor
25
+from glance.async_.flows import convert
26
+from glance.async_ import taskflow_executor
27 27
 from glance.common.scripts import utils as script_utils
28 28
 from glance.common import utils
29 29
 from glance import domain

glance/tests/unit/async/flows/test_import.py → glance/tests/unit/async_/flows/test_import.py View File

@@ -25,9 +25,9 @@ from six.moves import urllib
25 25
 from taskflow import task
26 26
 from taskflow.types import failure
27 27
 
28
-import glance.async.flows.base_import as import_flow
29
-from glance.async import taskflow_executor
30
-from glance.async import utils as async_utils
28
+import glance.async_.flows.base_import as import_flow
29
+from glance.async_ import taskflow_executor
30
+from glance.async_ import utils as async_utils
31 31
 from glance.common.scripts.image_import import main as image_import
32 32
 from glance.common.scripts import utils as script_utils
33 33
 from glance.common import utils

glance/tests/unit/async/flows/test_introspect.py → glance/tests/unit/async_/flows/test_introspect.py View File

@@ -20,8 +20,8 @@ import glance_store
20 20
 from oslo_concurrency import processutils
21 21
 from oslo_config import cfg
22 22
 
23
-from glance.async.flows import introspect
24
-from glance.async import utils as async_utils
23
+from glance.async_.flows import introspect
24
+from glance.async_ import utils as async_utils
25 25
 from glance import domain
26 26
 import glance.tests.utils as test_utils
27 27
 

glance/tests/unit/async/flows/test_ovf_process.py → glance/tests/unit/async_/flows/test_ovf_process.py View File

@@ -24,7 +24,7 @@ try:
24 24
 except ImportError:
25 25
     from defusedxml.ElementTree import ParseError
26 26
 
27
-from glance.async.flows import ovf_process
27
+from glance.async_.flows import ovf_process
28 28
 import glance.tests.utils as test_utils
29 29
 from oslo_config import cfg
30 30
 

glance/tests/unit/async/flows/test_web_download.py → glance/tests/unit/async_/flows/test_web_download.py View File

@@ -19,7 +19,7 @@ from glance_store._drivers import filesystem
19 19
 from glance_store import backend
20 20
 from oslo_config import cfg
21 21
 
22
-from glance.async.flows._internal_plugins import web_download
22
+from glance.async_.flows._internal_plugins import web_download
23 23
 
24 24
 import glance.common.exception
25 25
 import glance.common.scripts.utils as script_utils

glance/tests/unit/async/test_async.py → glance/tests/unit/async_/test_async.py View File

@@ -16,7 +16,7 @@
16 16
 
17 17
 import mock
18 18
 
19
-import glance.async
19
+import glance.async_
20 20
 import glance.tests.utils as test_utils
21 21
 
22 22
 
@@ -28,10 +28,10 @@ class TestTaskExecutor(test_utils.BaseTestCase):
28 28
         self.task_repo = mock.Mock()
29 29
         self.image_repo = mock.Mock()
30 30
         self.image_factory = mock.Mock()
31
-        self.executor = glance.async.TaskExecutor(self.context,
32
-                                                  self.task_repo,
33
-                                                  self.image_repo,
34
-                                                  self.image_factory)
31
+        self.executor = glance.async_.TaskExecutor(self.context,
32
+                                                   self.task_repo,
33
+                                                   self.image_repo,
34
+                                                   self.image_factory)
35 35
 
36 36
     def test_begin_processing(self):
37 37
         # setup
@@ -40,7 +40,7 @@ class TestTaskExecutor(test_utils.BaseTestCase):
40 40
         task = mock.Mock()
41 41
 
42 42
         with mock.patch.object(
43
-                glance.async.TaskExecutor,
43
+                glance.async_.TaskExecutor,
44 44
                 '_run') as mock_run:
45 45
             self.task_repo.get.return_value = task
46 46
             self.executor.begin_processing(task_id)

glance/tests/unit/async/test_taskflow_executor.py → glance/tests/unit/async_/test_taskflow_executor.py View File

@@ -19,7 +19,7 @@ import glance_store
19 19
 from oslo_config import cfg
20 20
 from taskflow import engines
21 21
 
22
-from glance.async import taskflow_executor
22
+from glance.async_ import taskflow_executor
23 23
 from glance.common.scripts.image_import import main as image_import
24 24
 from glance import domain
25 25
 import glance.tests.utils as test_utils

+ 7
- 7
glance/tests/unit/test_domain.py View File

@@ -21,8 +21,8 @@ import mock
21 21
 from oslo_config import cfg
22 22
 import oslo_utils.importutils
23 23
 
24
-import glance.async
25
-from glance.async import taskflow_executor
24
+import glance.async_
25
+from glance.async_ import taskflow_executor
26 26
 from glance.common import exception
27 27
 from glance.common import timeutils
28 28
 from glance import domain
@@ -467,12 +467,12 @@ class TestTask(test_utils.BaseTestCase):
467 467
             self.task.expires_at
468 468
         )
469 469
 
470
-    @mock.patch.object(glance.async.TaskExecutor, 'begin_processing')
470
+    @mock.patch.object(glance.async_.TaskExecutor, 'begin_processing')
471 471
     def test_run(self, mock_begin_processing):
472
-        executor = glance.async.TaskExecutor(context=mock.ANY,
473
-                                             task_repo=mock.ANY,
474
-                                             image_repo=mock.ANY,
475
-                                             image_factory=mock.ANY)
472
+        executor = glance.async_.TaskExecutor(context=mock.ANY,
473
+                                              task_repo=mock.ANY,
474
+                                              image_repo=mock.ANY,
475
+                                              image_factory=mock.ANY)
476 476
         self.task.run(executor)
477 477
 
478 478
         mock_begin_processing.assert_called_once_with(self.task.task_id)

+ 3
- 3
glance/tests/unit/test_notifier.py View File

@@ -22,7 +22,7 @@ from oslo_config import cfg
22 22
 import oslo_messaging
23 23
 import webob
24 24
 
25
-import glance.async
25
+import glance.async_
26 26
 from glance.common import exception
27 27
 from glance.common import timeutils
28 28
 import glance.context
@@ -681,7 +681,7 @@ class TestTaskNotifications(utils.BaseTestCase):
681 681
         self.assertEqual(0, len(output_logs))
682 682
 
683 683
     def test_task_run_notification(self):
684
-        with mock.patch('glance.async.TaskExecutor') as mock_executor:
684
+        with mock.patch('glance.async_.TaskExecutor') as mock_executor:
685 685
             executor = mock_executor.return_value
686 686
             executor._run.return_value = mock.Mock()
687 687
             self.task_proxy.run(executor=mock_executor)
@@ -694,7 +694,7 @@ class TestTaskNotifications(utils.BaseTestCase):
694 694
 
695 695
     def test_task_run_notification_disabled(self):
696 696
         self.config(disabled_notifications=['task.run'])
697
-        with mock.patch('glance.async.TaskExecutor') as mock_executor:
697
+        with mock.patch('glance.async_.TaskExecutor') as mock_executor:
698 698
             executor = mock_executor.return_value
699 699
             executor._run.return_value = mock.Mock()
700 700
             self.task_proxy.run(executor=mock_executor)

+ 9
- 9
setup.cfg View File

@@ -63,21 +63,21 @@ glance.database.metadata_backend =
63 63
     sqlalchemy = glance.db.sqlalchemy.metadata
64 64
 
65 65
 glance.flows =
66
-    api_image_import = glance.async.flows.api_image_import:get_flow
67
-    import = glance.async.flows.base_import:get_flow
66
+    api_image_import = glance.async_.flows.api_image_import:get_flow
67
+    import = glance.async_.flows.base_import:get_flow
68 68
 
69 69
 glance.flows.import =
70
-    convert = glance.async.flows.convert:get_flow
71
-    introspect = glance.async.flows.introspect:get_flow
72
-    ovf_process = glance.async.flows.ovf_process:get_flow
70
+    convert = glance.async_.flows.convert:get_flow
71
+    introspect = glance.async_.flows.introspect:get_flow
72
+    ovf_process = glance.async_.flows.ovf_process:get_flow
73 73
 
74 74
 glance.image_import.plugins =
75
-    no_op = glance.async.flows.plugins.no_op:get_flow
76
-    inject_image_metadata=glance.async.flows.plugins.inject_image_metadata:get_flow
77
-    image_conversion=glance.async.flows.plugins.image_conversion:get_flow
75
+    no_op = glance.async_.flows.plugins.no_op:get_flow
76
+    inject_image_metadata=glance.async_.flows.plugins.inject_image_metadata:get_flow
77
+    image_conversion=glance.async_.flows.plugins.image_conversion:get_flow
78 78
 
79 79
 glance.image_import.internal_plugins =
80
-    web_download = glance.async.flows._internal_plugins.web_download:get_flow
80
+    web_download = glance.async_.flows._internal_plugins.web_download:get_flow
81 81
 
82 82
 
83 83
 [egg_info]

Loading…
Cancel
Save