summaryrefslogtreecommitdiff
path: root/ironic/conductor/rpcapi.py
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2018-01-18 11:11:16 +0000
committerJulia Kreger <juliaashleykreger@gmail.com>2018-01-24 21:23:05 +0000
commitc1cce7eb452c228dc2633e80f2c98fd142574fa9 (patch)
treee9a68c5aeb2cde3af04e189c783b81f966b384d5 /ironic/conductor/rpcapi.py
parent904f44522b665da52ec44133fbb8fc46c00d0105 (diff)
downloadironic-c1cce7eb452c228dc2633e80f2c98fd142574fa9.tar.gz
Add RPC API and conductor manager for traits
Adds two new methods to the conductor RPC API, add_node_traits and remove_node_traits, and provides implementations for them in the conductor manager. add_node_traits can be used to add one or more traits to a node, or to replace all the traits for a node. remove_node_traits can be used to remove one or more traits from a node, or to remove all traits from a node. The conductor RPC API version is bumped to 1.44. Change-Id: I0181df6a41e603874677246066d84bf4ac4f433c Partial-Bug: #1722194
Diffstat (limited to 'ironic/conductor/rpcapi.py')
-rw-r--r--ironic/conductor/rpcapi.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/ironic/conductor/rpcapi.py b/ironic/conductor/rpcapi.py
index e3ebcce80..8b1262dc7 100644
--- a/ironic/conductor/rpcapi.py
+++ b/ironic/conductor/rpcapi.py
@@ -92,13 +92,14 @@ class ConductorAPI(object):
| 1.41 - Added create_port
| 1.42 - Added optional agent_version to heartbeat
| 1.43 - Added do_node_rescue, do_node_unrescue and can_send_rescue
+ | 1.44 - Added add_node_traits and remove_node_traits.
"""
# NOTE(rloo): This must be in sync with manager.ConductorManager's.
# NOTE(pas-ha): This also must be in sync with
# ironic.common.release_mappings.RELEASE_MAPPING['master']
- RPC_API_VERSION = '1.43'
+ RPC_API_VERSION = '1.44'
def __init__(self, topic=None):
super(ConductorAPI, self).__init__()
@@ -1017,3 +1018,37 @@ class ConductorAPI(object):
"""
cctxt = self.client.prepare(topic=topic or self.topic, version='1.43')
return cctxt.call(context, 'do_node_unrescue', node_id=node_id)
+
+ def add_node_traits(self, context, node_id, traits, replace=False,
+ topic=None):
+ """Add or replace traits for a node.
+
+ :param context: request context.
+ :param node_id: node ID or UUID.
+ :param traits: a list of traits to add to the node.
+ :param replace: True to replace all of the node's traits.
+ :param topic: RPC topic. Defaults to self.topic.
+ :raises: InvalidParameterValue if adding the traits would exceed the
+ per-node traits limit.
+ :raises: NodeLocked if node is locked by another conductor.
+ :raises: NodeNotFound if the node does not exist.
+ """
+ cctxt = self.client.prepare(topic=topic or self.topic, version='1.44')
+ return cctxt.call(context, 'add_node_traits', node_id=node_id,
+ traits=traits, replace=replace)
+
+ def remove_node_traits(self, context, node_id, traits, topic=None):
+ """Remove some or all traits from a node.
+
+ :param context: request context.
+ :param node_id: node ID or UUID.
+ :param traits: a list of traits to remove from the node, or None. If
+ None, all traits will be removed from the node.
+ :param topic: RPC topic. Defaults to self.topic.
+ :raises: NodeLocked if node is locked by another conductor.
+ :raises: NodeNotFound if the node does not exist.
+ :raises: NodeTraitNotFound if one of the traits is not found.
+ """
+ cctxt = self.client.prepare(topic=topic or self.topic, version='1.44')
+ return cctxt.call(context, 'remove_node_traits', node_id=node_id,
+ traits=traits)