36
36
API version history:
38
1.0 - Initial version.
39
Included get_node_power_status
40
1.1 - Added update_node and start_power_state_change.
41
1.2 - Added vendor_passhthru.
42
1.3 - Rename start_power_state_change to change_node_power_state.
43
1.4 - Added do_node_deploy and do_node_tear_down.
44
1.5 - Added validate_driver_interfaces.
45
1.6 - change_node_power_state, do_node_deploy and do_node_tear_down
46
accept node id instead of node object.
47
1.7 - Added topic parameter to RPC methods.
48
1.8 - Added change_node_maintenance_mode.
49
1.9 - Added destroy_node.
50
1.10 - Remove get_node_power_state
51
1.11 - Added get_console_information, set_console_mode.
52
1.12 - validate_vendor_action, do_vendor_action replaced by single
53
vendor_passthru method.
54
1.13 - Added update_port.
55
1.14 - Added driver_vendor_passthru.
56
1.15 - Added rebuild parameter to do_node_deploy.
57
1.16 - Added get_driver_properties.
58
1.17 - Added set_boot_device, get_boot_device and
59
get_supported_boot_devices.
38
| 1.0 - Initial version.
39
| Included get_node_power_status
40
| 1.1 - Added update_node and start_power_state_change.
41
| 1.2 - Added vendor_passthru.
42
| 1.3 - Rename start_power_state_change to change_node_power_state.
43
| 1.4 - Added do_node_deploy and do_node_tear_down.
44
| 1.5 - Added validate_driver_interfaces.
45
| 1.6 - change_node_power_state, do_node_deploy and do_node_tear_down
46
| accept node id instead of node object.
47
| 1.7 - Added topic parameter to RPC methods.
48
| 1.8 - Added change_node_maintenance_mode.
49
| 1.9 - Added destroy_node.
50
| 1.10 - Remove get_node_power_state
51
| 1.11 - Added get_console_information, set_console_mode.
52
| 1.12 - validate_vendor_action, do_vendor_action replaced by single
53
| vendor_passthru method.
54
| 1.13 - Added update_port.
55
| 1.14 - Added driver_vendor_passthru.
56
| 1.15 - Added rebuild parameter to do_node_deploy.
57
| 1.16 - Added get_driver_properties.
58
| 1.17 - Added set_boot_device, get_boot_device and
59
| get_supported_boot_devices.
60
| 1.18 - Remove change_node_maintenance_mode.
61
| 1.19 - Change return value of vendor_passthru and
62
| driver_vendor_passthru
63
| 1.20 - Added http_method parameter to vendor_passthru and
64
| driver_vendor_passthru
65
| 1.21 - Added get_node_vendor_passthru_methods and
66
| get_driver_vendor_passthru_methods
63
70
# NOTE(rloo): This must be in sync with manager.ConductorManager's.
64
RPC_API_VERSION = '1.17'
71
RPC_API_VERSION = '1.21'
66
73
def __init__(self, topic=None):
67
74
super(ConductorAPI, self).__init__()
99
105
raise exception.NoValidHost(reason=reason)
101
107
def get_topic_for_driver(self, driver_name):
102
"""Get an RPC topic which will route messages to a conductor which
103
supports the specified driver. A conductor is selected at
104
random from the set of qualified conductors.
108
"""Get RPC topic name for a conductor supporting the given driver.
110
The topic is used to route messages to the conductor supporting
111
the specified driver. A conductor is selected at random from the
112
set of qualified conductors.
106
114
:param driver_name: the name of the driver to route to.
107
115
:returns: an RPC topic string.
136
144
return cctxt.call(context, 'update_node', node_obj=node_obj)
138
146
def change_node_power_state(self, context, node_id, new_state, topic=None):
139
"""Synchronously, acquire lock and start the conductor background task
147
"""Change a node's power state.
149
Synchronously, acquire lock and start the conductor background task
140
150
to change power state of a node.
142
152
:param context: request context.
151
161
return cctxt.call(context, 'change_node_power_state', node_id=node_id,
152
162
new_state=new_state)
154
def vendor_passthru(self, context, node_id, driver_method, info,
156
"""Synchronously, acquire lock, validate given parameters and start
157
the conductor background task for specified vendor action.
164
def vendor_passthru(self, context, node_id, driver_method, http_method,
166
"""Receive requests for vendor-specific actions.
168
Synchronously validate driver specific info or get driver status,
169
and if successful invokes the vendor method. If the method mode
170
is async the conductor will start background worker to perform
159
173
:param context: request context.
160
174
:param node_id: node id or uuid.
161
175
:param driver_method: name of method for driver.
176
:param http_method: the HTTP method used for the request.
162
177
:param info: info for node driver.
163
178
:param topic: RPC topic. Defaults to self.topic.
164
179
:raises: InvalidParameterValue if supplied info is not valid.
167
182
vendor interface.
168
183
:raises: NoFreeConductorWorker when there is no free worker to start
185
:raises: NodeLocked if node is locked by another conductor.
186
:returns: A tuple containing the response of the invoked method
187
and a boolean value indicating whether the method was
188
invoked asynchronously (True) or synchronously (False).
189
If invoked asynchronously the response field will be
172
cctxt = self.client.prepare(topic=topic or self.topic, version='1.12')
193
cctxt = self.client.prepare(topic=topic or self.topic, version='1.20')
173
194
return cctxt.call(context, 'vendor_passthru', node_id=node_id,
174
driver_method=driver_method, info=info)
195
driver_method=driver_method,
196
http_method=http_method,
176
def driver_vendor_passthru(self, context, driver_name, driver_method, info,
199
def driver_vendor_passthru(self, context, driver_name, driver_method,
200
http_method, info, topic=None):
178
201
"""Pass vendor-specific calls which don't specify a node to a driver.
203
Handles driver-level vendor passthru calls. These calls don't
204
require a node UUID and are executed on a random conductor with
205
the specified driver. If the method mode is async the conductor
206
will start background worker to perform vendor action.
180
208
:param context: request context.
181
209
:param driver_name: name of the driver on which to call the method.
182
210
:param driver_method: name of the vendor method, for use by the driver.
211
:param http_method: the HTTP method used for the request.
183
212
:param info: data to pass through to the driver.
184
213
:param topic: RPC topic. Defaults to self.topic.
185
214
:raises: InvalidParameterValue for parameter errors.
187
216
:raises: UnsupportedDriverExtension if the driver doesn't have a vendor
188
217
interface, or if the vendor interface does not support the
189
218
specified driver_method.
219
:raises: DriverNotFound if the supplied driver is not loaded.
220
:raises: NoFreeConductorWorker when there is no free worker to start
222
:returns: A tuple containing the response of the invoked method
223
and a boolean value indicating whether the method was
224
invoked asynchronously (True) or synchronously (False).
225
If invoked asynchronously the response field will be
192
cctxt = self.client.prepare(topic=topic or self.topic, version='1.14')
229
cctxt = self.client.prepare(topic=topic or self.topic, version='1.20')
193
230
return cctxt.call(context, 'driver_vendor_passthru',
194
231
driver_name=driver_name,
195
232
driver_method=driver_method,
233
http_method=http_method,
236
def get_node_vendor_passthru_methods(self, context, node_id, topic=None):
237
"""Retrieve information about vendor methods of the given node.
239
:param context: an admin context.
240
:param node_id: the id or uuid of a node.
241
:param topic: RPC topic. Defaults to self.topic.
242
:returns: dictionary of <method name>:<method metadata> entries.
245
cctxt = self.client.prepare(topic=topic or self.topic, version='1.21')
246
return cctxt.call(context, 'get_node_vendor_passthru_methods',
249
def get_driver_vendor_passthru_methods(self, context, driver_name,
251
"""Retrieve information about vendor methods of the given driver.
253
:param context: an admin context.
254
:param driver_name: name of the driver.
255
:param topic: RPC topic. Defaults to self.topic.
256
:returns: dictionary of <method name>:<method metadata> entries.
259
cctxt = self.client.prepare(topic=topic or self.topic, version='1.21')
260
return cctxt.call(context, 'get_driver_vendor_passthru_methods',
261
driver_name=driver_name)
198
263
def do_node_deploy(self, context, node_id, rebuild, topic=None):
199
264
"""Signal to conductor service to perform a deployment.
249
314
return cctxt.call(context, 'validate_driver_interfaces',
252
def change_node_maintenance_mode(self, context, node_id, mode, topic=None):
253
"""Set node maintenance mode on or off.
255
:param context: request context.
256
:param node_id: node id or uuid.
257
:param mode: True or False.
258
:param topic: RPC topic. Defaults to self.topic.
259
:returns: a node object.
260
:raises: NodeMaintenanceFailure.
263
cctxt = self.client.prepare(topic=topic or self.topic, version='1.8')
264
return cctxt.call(context, 'change_node_maintenance_mode',
265
node_id=node_id, mode=mode)
267
317
def destroy_node(self, context, node_id, topic=None):
268
318
"""Delete a node.