summaryrefslogtreecommitdiff
path: root/ironic/conductor
diff options
context:
space:
mode:
authorSatoru Moriya <satoru.moriya.br@hitachi.com>2016-02-09 21:54:42 +0900
committerRuby Loo <ruby.loo@intel.com>2016-11-24 12:10:42 -0500
commit20fe26335ef34b6a3d3032c5a844fddc5afdf7f5 (patch)
tree11d152b106c4c39cbab4887b44f5694898435526 /ironic/conductor
parentbc7daf977983c98ed6e9edc3e113808aa78b588e (diff)
downloadironic-20fe26335ef34b6a3d3032c5a844fddc5afdf7f5.tar.gz
Add RPCs to support volume connector operation
This patch adds the following two RPCs in order to support volume connector operations. - update_volume_connector() This function is called to update the information about a volume connector that is stored in the database. - destroy_volume_connector() This function is called to remove a volume connector from the database. Co-Authored-By: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com> Co-Authored-By: Stephanie Miller <stephane@alum.mit.edu> Co-Authored-By: Ruby Loo <ruby.loo@intel.com> Change-Id: I3debe98ea78e159a81f53d0a3a3a49fe0c8663f6 Partial-Bug: 1526231
Diffstat (limited to 'ironic/conductor')
-rw-r--r--ironic/conductor/manager.py65
-rw-r--r--ironic/conductor/rpcapi.py49
2 files changed, 112 insertions, 2 deletions
diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py
index 85924db55..74b31cd04 100644
--- a/ironic/conductor/manager.py
+++ b/ironic/conductor/manager.py
@@ -82,7 +82,7 @@ class ConductorManager(base_manager.BaseConductorManager):
"""Ironic Conductor manager main class."""
# NOTE(rloo): This must be in sync with rpcapi.ConductorAPI's.
- RPC_API_VERSION = '1.34'
+ RPC_API_VERSION = '1.35'
target = messaging.Target(version=RPC_API_VERSION)
@@ -1537,6 +1537,33 @@ class ConductorManager(base_manager.BaseConductorManager):
'%(node)s'),
{'portgroup': portgroup.uuid, 'node': task.node.uuid})
+ @METRICS.timer('ConductorManager.destroy_volume_connector')
+ @messaging.expected_exceptions(exception.NodeLocked,
+ exception.NodeNotFound,
+ exception.VolumeConnectorNotFound)
+ def destroy_volume_connector(self, context, connector):
+ """Delete a volume connector.
+
+ :param context: request context
+ :param connector: volume connector object
+ :raises: NodeLocked if node is locked by another conductor
+ :raises: NodeNotFound if the node associated with the connector does
+ not exist
+ :raises: VolumeConnectorNotFound if the volume connector cannot be
+ found
+ """
+ LOG.debug('RPC destroy_volume_connector called for volume connector '
+ '%(connector)s',
+ {'connector': connector.uuid})
+ with task_manager.acquire(context, connector.node_id,
+ purpose='volume connector deletion') as task:
+ connector.destroy()
+ LOG.info(_LI('Successfully deleted volume connector '
+ '%(connector)s. '
+ 'The node associated with the connector was '
+ '%(node)s'),
+ {'connector': connector.uuid, 'node': task.node.uuid})
+
@METRICS.timer('ConductorManager.get_console_information')
@messaging.expected_exceptions(exception.NodeLocked,
exception.UnsupportedDriverExtension,
@@ -1833,6 +1860,42 @@ class ConductorManager(base_manager.BaseConductorManager):
return portgroup_obj
+ @METRICS.timer('ConductorManager.update_volume_connector')
+ @messaging.expected_exceptions(
+ exception.InvalidParameterValue,
+ exception.NodeLocked,
+ exception.NodeNotFound,
+ exception.VolumeConnectorNotFound,
+ exception.VolumeConnectorTypeAndIdAlreadyExists)
+ def update_volume_connector(self, context, connector):
+ """Update a volume connector.
+
+ :param context: request context
+ :param connector: a changed (but not saved) volume connector object
+ :returns: an updated volume connector object
+ :raises: InvalidParameterValue if the volume connector's UUID is being
+ changed
+ :raises: NodeLocked if the node is already locked
+ :raises: NodeNotFound if the node associated with the conductor does
+ not exist
+ :raises: VolumeConnectorNotFound if the volume connector cannot be
+ found
+ :raises: VolumeConnectorTypeAndIdAlreadyExists if another connector
+ already exists with the same values for type and connector_id
+ fields
+ """
+ LOG.debug("RPC update_volume_connector called for connector "
+ "%(connector)s.",
+ {'connector': connector.uuid})
+
+ with task_manager.acquire(context, connector.node_id,
+ purpose='volume connector update'):
+ connector.save()
+ LOG.info(_LI("Successfully updated volume connector "
+ "%(connector)s."),
+ {'connector': connector.uuid})
+ return connector
+
@METRICS.timer('ConductorManager.get_driver_properties')
@messaging.expected_exceptions(exception.DriverNotFound)
def get_driver_properties(self, context, driver_name):
diff --git a/ironic/conductor/rpcapi.py b/ironic/conductor/rpcapi.py
index 9b4b5c765..a61e41fa2 100644
--- a/ironic/conductor/rpcapi.py
+++ b/ironic/conductor/rpcapi.py
@@ -81,11 +81,12 @@ class ConductorAPI(object):
| 1.32 - Add do_node_clean
| 1.33 - Added update and destroy portgroup.
| 1.34 - Added heartbeat
+ | 1.35 - Added destroy_volume_connector and update_volume_connector
"""
# NOTE(rloo): This must be in sync with manager.ConductorManager's.
- RPC_API_VERSION = '1.34'
+ RPC_API_VERSION = '1.35'
def __init__(self, topic=None):
super(ConductorAPI, self).__init__()
@@ -735,3 +736,49 @@ class ConductorAPI(object):
cctxt = self.client.prepare(topic=self.topic, version='1.31')
return cctxt.call(context, 'object_backport_versions', objinst=objinst,
object_versions=object_versions)
+
+ def destroy_volume_connector(self, context, connector, topic=None):
+ """Delete a volume connector.
+
+ Delete the volume connector. The conductor will lock the related node
+ during this operation.
+
+ :param context: request context
+ :param connector: volume connector object
+ :param topic: RPC topic. Defaults to self.topic.
+ :raises: NodeLocked if node is locked by another conductor
+ :raises: NodeNotFound if the node associated with the connector does
+ not exist
+ :raises: VolumeConnectorNotFound if the volume connector cannot be
+ found
+ """
+ cctxt = self.client.prepare(topic=topic or self.topic, version='1.35')
+ return cctxt.call(context, 'destroy_volume_connector',
+ connector=connector)
+
+ def update_volume_connector(self, context, connector, topic=None):
+ """Update the volume connector's information.
+
+ Update the volume connector's information in the database and return
+ a volume connector object. The conductor will lock the related node
+ during this operation.
+
+ :param context: request context
+ :param connector: a changed (but not saved) volume connector object
+ :param topic: RPC topic. Defaults to self.topic.
+ :raises: InvalidParameterValue if the volume connector's UUID is being
+ changed
+ :raises: NodeLocked if node is locked by another conductor
+ :raises: NodeNotFound if the node associated with the connector does
+ not exist
+ :raises: VolumeConnectorNotFound if the volume connector cannot be
+ found
+ :raises: VolumeConnectorTypeAndIdAlreadyExists if another connector
+ already exists with the same values for type and connector_id
+ fields
+ :returns: updated volume connector object, including all fields.
+
+ """
+ cctxt = self.client.prepare(topic=topic or self.topic, version='1.35')
+ return cctxt.call(context, 'update_volume_connector',
+ connector=connector)