summaryrefslogtreecommitdiff
path: root/ironic/common
diff options
context:
space:
mode:
authorJim Rollenhagen <jim@jimrollenhagen.com>2017-01-11 17:01:51 +0000
committerJim Rollenhagen <jim@jimrollenhagen.com>2017-01-30 22:12:55 +0000
commite77675781231409d16744ab9d1b13ffc92d358f6 (patch)
treebf7ab1179a9e97427ab5844c339ac42e1cf9ca28 /ironic/common
parent1dc154033f294c34a4ea3f52d89522a59f31f26c (diff)
downloadironic-e77675781231409d16744ab9d1b13ffc92d358f6.tar.gz
Add dynamic driver functionality to REST API
This adds API version 1.30, which adds dynamic driver parameters and response fields to `GET /v1/drivers` and `GET /v1/drivers/<name>`. Changes RAID APIs to work for dynamic drivers. Also changes GET /v1/drivers/<name>/properties to work for dynamic drivers. It uses the calculated default implementation for each interface, when calculating the properties. Last, changes node and driver vendor passthru to work correctly for dynamic drivers. Similar to properties, driver vendor passthru will use the calculated default vendor implementation. Change-Id: If13e7e7fd368273e84d9a108be93b58150432fae Partial-Bug: #1524745
Diffstat (limited to 'ironic/common')
-rw-r--r--ironic/common/driver_factory.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ironic/common/driver_factory.py b/ironic/common/driver_factory.py
index 1b9e9e410..e6105e6e2 100644
--- a/ironic/common/driver_factory.py
+++ b/ironic/common/driver_factory.py
@@ -95,11 +95,11 @@ def _attach_interfaces_to_driver(bare_driver, node, driver_or_hw_type):
for iface in dynamic_interfaces:
impl_name = getattr(node, '%s_interface' % iface)
- impl = _get_interface(driver_or_hw_type, iface, impl_name)
+ impl = get_interface(driver_or_hw_type, iface, impl_name)
setattr(bare_driver, iface, impl)
-def _get_interface(driver_or_hw_type, interface_type, interface_name):
+def get_interface(driver_or_hw_type, interface_type, interface_name):
"""Get interface implementation instance.
For hardware types also validates compatibility.
@@ -170,7 +170,7 @@ def default_interface(driver_or_hw_type, interface_type):
if impl_name is not None:
# Check that the default is correct for this type
- _get_interface(driver_or_hw_type, interface_type, impl_name)
+ get_interface(driver_or_hw_type, interface_type, impl_name)
elif is_hardware_type:
supported = getattr(driver_or_hw_type,
'supported_%s_interfaces' % interface_type)
@@ -230,7 +230,7 @@ def check_and_update_node_interfaces(node, driver_or_hw_type=None):
impl_name = getattr(node, field_name)
if impl_name is not None:
# Check that the provided value is correct for this type
- _get_interface(driver_or_hw_type, iface, impl_name)
+ get_interface(driver_or_hw_type, iface, impl_name)
# Not changing the result, proceeding with the next interface
continue