diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-01-21 15:23:18 +0100 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-01-22 11:15:38 +0100 |
commit | 31b73b498453ff25275a43c46c5bfa023585327a (patch) | |
tree | d702ec0bb2828d22f725bc0d9e7fd96b1bd6ee41 /ironic_python_agent/hardware.py | |
parent | 4b602771e96bfd7f5334f41108231d4d4fa8a67d (diff) | |
download | ironic-python-agent-31b73b498453ff25275a43c46c5bfa023585327a.tar.gz |
Expose collector and hardware manager names via introspection data
This change adds a new introspection data field 'configuration'
with two lists: managers and collectors.
Change-Id: Ice0d7e6ecff3f319bc3a4f41617059fd6914e31c
Diffstat (limited to 'ironic_python_agent/hardware.py')
-rw-r--r-- | ironic_python_agent/hardware.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py index 06cf3def..14c2ccee 100644 --- a/ironic_python_agent/hardware.py +++ b/ironic_python_agent/hardware.py @@ -1847,7 +1847,7 @@ def _compare_extensions(ext1, ext2): return mgr2.evaluate_hardware_support() - mgr1.evaluate_hardware_support() -def _get_managers(): +def get_managers(): """Get a list of hardware managers in priority order. Use stevedore to find all eligible hardware managers, sort them based on @@ -1889,7 +1889,7 @@ def dispatch_to_all_managers(method, *args, **kwargs): """Dispatch a method to all hardware managers. Dispatches the given method in priority order as sorted by - `_get_managers`. If the method doesn't exist or raises + `get_managers`. If the method doesn't exist or raises IncompatibleHardwareMethodError, it continues to the next hardware manager. All managers that have hardware support for this node will be called, and their responses will be added to a dictionary of the form @@ -1905,7 +1905,7 @@ def dispatch_to_all_managers(method, *args, **kwargs): manager. """ responses = {} - managers = _get_managers() + managers = get_managers() for manager in managers: if getattr(manager, method, None): try: @@ -1934,7 +1934,7 @@ def dispatch_to_managers(method, *args, **kwargs): """Dispatch a method to best suited hardware manager. Dispatches the given method in priority order as sorted by - `_get_managers`. If the method doesn't exist or raises + `get_managers`. If the method doesn't exist or raises IncompatibleHardwareMethodError, it is attempted again with a more generic hardware manager. This continues until a method executes that returns any result without raising an IncompatibleHardwareMethodError. @@ -1947,7 +1947,7 @@ def dispatch_to_managers(method, *args, **kwargs): :raises HardwareManagerMethodNotFound: if all managers failed the method :raises HardwareManagerNotFound: if no valid hardware managers found """ - managers = _get_managers() + managers = get_managers() for manager in managers: if getattr(manager, method, None): try: @@ -1967,18 +1967,6 @@ def dispatch_to_managers(method, *args, **kwargs): raise errors.HardwareManagerMethodNotFound(method) -def load_managers(): - """Preload hardware managers into the cache. - - This method is to help warm up the cache for hardware managers when - called. Used to resolve bug 1490008, where agents can crash the first - time a hardware manager is needed. - - :raises HardwareManagerNotFound: if no valid hardware managers found - """ - _get_managers() - - def cache_node(node): """Store the node object in the hardware module. |