151
154
instance_p = jsonutils.to_primitive(instance)
152
155
self.cast(ctxt, self.make_msg('add_fixed_ip_to_instance',
153
156
instance=instance_p, network_id=network_id),
154
topic=_compute_topic(self.topic, ctxt, None, instance),
157
topic=_compute_topic(self.topic, ctxt, None, instance))
157
159
def attach_volume(self, ctxt, instance, volume_id, mountpoint):
158
160
instance_p = jsonutils.to_primitive(instance)
159
161
self.cast(ctxt, self.make_msg('attach_volume',
160
162
instance=instance_p, volume_id=volume_id,
161
163
mountpoint=mountpoint),
162
topic=_compute_topic(self.topic, ctxt, None, instance),
164
topic=_compute_topic(self.topic, ctxt, None, instance))
165
166
def change_instance_metadata(self, ctxt, instance, diff):
166
167
instance_p = jsonutils.to_primitive(instance)
167
168
self.cast(ctxt, self.make_msg('change_instance_metadata',
168
169
instance=instance_p, diff=diff),
169
topic=_compute_topic(self.topic, ctxt, None, instance),
170
topic=_compute_topic(self.topic, ctxt, None, instance))
172
172
def check_can_live_migrate_destination(self, ctxt, instance, destination,
173
173
block_migration, disk_over_commit):
178
178
block_migration=block_migration,
179
179
disk_over_commit=disk_over_commit),
180
180
topic=_compute_topic(self.topic,
181
ctxt, destination, None),
181
ctxt, destination, None))
184
183
def check_can_live_migrate_source(self, ctxt, instance, dest_check_data):
185
184
instance_p = jsonutils.to_primitive(instance)
186
185
self.call(ctxt, self.make_msg('check_can_live_migrate_source',
187
186
instance=instance_p,
188
187
dest_check_data=dest_check_data),
189
topic=_compute_topic(self.topic, ctxt, None, instance),
188
topic=_compute_topic(self.topic, ctxt, None, instance))
192
190
def confirm_resize(self, ctxt, instance, migration_id, host,
193
191
reservations=None, cast=True):
196
194
return rpc_method(ctxt, self.make_msg('confirm_resize',
197
195
instance=instance_p, migration_id=migration_id,
198
196
reservations=reservations),
199
topic=_compute_topic(self.topic, ctxt, host, instance),
197
topic=_compute_topic(self.topic, ctxt, host, instance))
202
199
def detach_volume(self, ctxt, instance, volume_id):
203
200
instance_p = jsonutils.to_primitive(instance)
204
201
self.cast(ctxt, self.make_msg('detach_volume',
205
202
instance=instance_p, volume_id=volume_id),
206
topic=_compute_topic(self.topic, ctxt, None, instance),
203
topic=_compute_topic(self.topic, ctxt, None, instance))
209
205
def finish_resize(self, ctxt, instance, migration_id, image, disk_info,
210
206
host, reservations=None):
212
208
self.cast(ctxt, self.make_msg('finish_resize',
213
209
instance=instance_p, migration_id=migration_id,
214
210
image=image, disk_info=disk_info, reservations=reservations),
215
topic=_compute_topic(self.topic, ctxt, host, None),
211
topic=_compute_topic(self.topic, ctxt, host, None))
218
213
def finish_revert_resize(self, ctxt, instance, migration_id, host,
219
214
reservations=None):
221
216
self.cast(ctxt, self.make_msg('finish_revert_resize',
222
217
instance=instance_p, migration_id=migration_id,
223
218
reservations=reservations),
224
topic=_compute_topic(self.topic, ctxt, host, None),
219
topic=_compute_topic(self.topic, ctxt, host, None))
227
221
def get_console_output(self, ctxt, instance, tail_length):
228
222
instance_p = jsonutils.to_primitive(instance)
229
223
return self.call(ctxt, self.make_msg('get_console_output',
230
224
instance=instance_p, tail_length=tail_length),
231
topic=_compute_topic(self.topic, ctxt, None, instance),
225
topic=_compute_topic(self.topic, ctxt, None, instance))
234
227
def get_console_pool_info(self, ctxt, console_type, host):
235
228
return self.call(ctxt, self.make_msg('get_console_pool_info',
244
237
instance_p = jsonutils.to_primitive(instance)
245
238
return self.call(ctxt, self.make_msg('get_diagnostics',
246
239
instance=instance_p),
247
topic=_compute_topic(self.topic, ctxt, None, instance),
240
topic=_compute_topic(self.topic, ctxt, None, instance))
250
242
def get_vnc_console(self, ctxt, instance, console_type):
251
243
instance_p = jsonutils.to_primitive(instance)
252
244
return self.call(ctxt, self.make_msg('get_vnc_console',
253
245
instance=instance_p, console_type=console_type),
254
topic=_compute_topic(self.topic, ctxt, None, instance),
246
topic=_compute_topic(self.topic, ctxt, None, instance))
257
248
def host_maintenance_mode(self, ctxt, host_param, mode, host):
258
249
'''Set host maintenance mode
277
268
self.cast(ctxt, self.make_msg('inject_file',
278
269
instance=instance_p, path=path,
279
270
file_contents=file_contents),
280
topic=_compute_topic(self.topic, ctxt, None, instance),
271
topic=_compute_topic(self.topic, ctxt, None, instance))
283
273
def inject_network_info(self, ctxt, instance):
284
274
instance_p = jsonutils.to_primitive(instance)
285
275
self.cast(ctxt, self.make_msg('inject_network_info',
286
276
instance=instance_p),
287
topic=_compute_topic(self.topic, ctxt, None, instance),
277
topic=_compute_topic(self.topic, ctxt, None, instance))
290
279
def live_migration(self, ctxt, instance, dest, block_migration, host,
291
280
migrate_data=None):
293
282
self.cast(ctxt, self.make_msg('live_migration', instance=instance_p,
294
283
dest=dest, block_migration=block_migration,
295
284
migrate_data=migrate_data),
296
topic=_compute_topic(self.topic, ctxt, host, None),
285
topic=_compute_topic(self.topic, ctxt, host, None))
299
287
def pause_instance(self, ctxt, instance):
300
288
instance_p = jsonutils.to_primitive(instance)
301
289
self.cast(ctxt, self.make_msg('pause_instance',
302
290
instance=instance_p),
303
topic=_compute_topic(self.topic, ctxt, None, instance),
291
topic=_compute_topic(self.topic, ctxt, None, instance))
306
293
def post_live_migration_at_destination(self, ctxt, instance,
307
294
block_migration, host):
309
296
return self.call(ctxt,
310
297
self.make_msg('post_live_migration_at_destination',
311
298
instance=instance_p, block_migration=block_migration),
312
_compute_topic(self.topic, ctxt, host, None),
299
_compute_topic(self.topic, ctxt, host, None))
315
301
def power_off_instance(self, ctxt, instance):
316
302
instance_p = jsonutils.to_primitive(instance)
317
303
self.cast(ctxt, self.make_msg('power_off_instance',
318
304
instance=instance_p),
319
topic=_compute_topic(self.topic, ctxt, None, instance),
305
topic=_compute_topic(self.topic, ctxt, None, instance))
322
307
def power_on_instance(self, ctxt, instance):
323
308
instance_p = jsonutils.to_primitive(instance)
324
309
self.cast(ctxt, self.make_msg('power_on_instance',
325
310
instance=instance_p),
326
topic=_compute_topic(self.topic, ctxt, None, instance),
311
topic=_compute_topic(self.topic, ctxt, None, instance))
329
313
def pre_live_migration(self, ctxt, instance, block_migration, disk,
331
315
instance_p = jsonutils.to_primitive(instance)
332
316
return self.call(ctxt, self.make_msg('pre_live_migration',
333
317
instance=instance_p, block_migration=block_migration,
334
disk=disk), _compute_topic(self.topic, ctxt, host, None),
318
disk=disk), _compute_topic(self.topic, ctxt, host, None))
337
320
def prep_resize(self, ctxt, image, instance, instance_type, host,
338
321
reservations=None):
341
324
self.cast(ctxt, self.make_msg('prep_resize',
342
325
instance=instance_p, instance_type=instance_type_p,
343
326
image=image, reservations=reservations),
344
_compute_topic(self.topic, ctxt, host, None),
327
_compute_topic(self.topic, ctxt, host, None))
347
329
def reboot_instance(self, ctxt, instance, reboot_type):
348
330
instance_p = jsonutils.to_primitive(instance)
349
331
self.cast(ctxt, self.make_msg('reboot_instance',
350
332
instance=instance_p, reboot_type=reboot_type),
351
topic=_compute_topic(self.topic, ctxt, None, instance),
333
topic=_compute_topic(self.topic, ctxt, None, instance))
354
335
def rebuild_instance(self, ctxt, instance, new_pass, injected_files,
355
image_ref, orig_image_ref):
336
image_ref, orig_image_ref, orig_sys_metadata):
356
337
instance_p = jsonutils.to_primitive(instance)
357
338
self.cast(ctxt, self.make_msg('rebuild_instance',
358
339
instance=instance_p, new_pass=new_pass,
359
340
injected_files=injected_files, image_ref=image_ref,
360
orig_image_ref=orig_image_ref),
361
topic=_compute_topic(self.topic, ctxt, None, instance),
341
orig_image_ref=orig_image_ref,
342
orig_sys_metadata=orig_sys_metadata),
343
topic=_compute_topic(self.topic, ctxt, None, instance))
364
345
def refresh_provider_fw_rules(self, ctxt, host):
365
346
self.cast(ctxt, self.make_msg('refresh_provider_fw_rules'),
366
347
_compute_topic(self.topic, ctxt, host, None))
368
def refresh_security_group_rules(self, ctxt, security_group_id, host):
369
self.cast(ctxt, self.make_msg('refresh_security_group_rules',
370
security_group_id=security_group_id),
371
topic=_compute_topic(self.topic, ctxt, host, None))
373
def refresh_security_group_members(self, ctxt, security_group_id,
375
self.cast(ctxt, self.make_msg('refresh_security_group_members',
376
security_group_id=security_group_id),
377
topic=_compute_topic(self.topic, ctxt, host, None))
379
349
def remove_aggregate_host(self, ctxt, aggregate_id, host_param, host):
380
350
'''Remove aggregate host.
393
363
instance_p = jsonutils.to_primitive(instance)
394
364
self.cast(ctxt, self.make_msg('remove_fixed_ip_from_instance',
395
365
instance=instance_p, address=address),
396
topic=_compute_topic(self.topic, ctxt, None, instance),
366
topic=_compute_topic(self.topic, ctxt, None, instance))
399
368
def remove_volume_connection(self, ctxt, instance, volume_id, host):
400
369
instance_p = jsonutils.to_primitive(instance)
401
370
return self.call(ctxt, self.make_msg('remove_volume_connection',
402
371
instance=instance_p, volume_id=volume_id),
403
topic=_compute_topic(self.topic, ctxt, host, None),
372
topic=_compute_topic(self.topic, ctxt, host, None))
406
374
def rescue_instance(self, ctxt, instance, rescue_password):
407
375
instance_p = jsonutils.to_primitive(instance)
408
376
self.cast(ctxt, self.make_msg('rescue_instance',
409
377
instance=instance_p,
410
378
rescue_password=rescue_password),
411
topic=_compute_topic(self.topic, ctxt, None, instance),
379
topic=_compute_topic(self.topic, ctxt, None, instance))
414
381
def reset_network(self, ctxt, instance):
415
382
instance_p = jsonutils.to_primitive(instance)
416
383
self.cast(ctxt, self.make_msg('reset_network',
417
384
instance=instance_p),
418
topic=_compute_topic(self.topic, ctxt, None, instance),
385
topic=_compute_topic(self.topic, ctxt, None, instance))
421
387
def resize_instance(self, ctxt, instance, migration_id, image,
422
388
reservations=None):
424
390
instance_p = jsonutils.to_primitive(instance)
425
391
self.cast(ctxt, self.make_msg('resize_instance',
426
392
instance=instance_p, migration_id=migration_id,
427
image=image, reservations=reservations), topic,
393
image=image, reservations=reservations), topic)
430
395
def resume_instance(self, ctxt, instance):
431
396
instance_p = jsonutils.to_primitive(instance)
432
397
self.cast(ctxt, self.make_msg('resume_instance',
433
398
instance=instance_p),
434
topic=_compute_topic(self.topic, ctxt, None, instance),
399
topic=_compute_topic(self.topic, ctxt, None, instance))
437
401
def revert_resize(self, ctxt, instance, migration_id, host,
438
402
reservations=None):
440
404
self.cast(ctxt, self.make_msg('revert_resize',
441
405
instance=instance_p, migration_id=migration_id,
442
406
reservations=reservations),
443
topic=_compute_topic(self.topic, ctxt, host, instance),
407
topic=_compute_topic(self.topic, ctxt, host, instance))
446
409
def rollback_live_migration_at_destination(self, ctxt, instance, host):
447
410
instance_p = jsonutils.to_primitive(instance)
448
411
self.cast(ctxt, self.make_msg('rollback_live_migration_at_destination',
449
412
instance=instance_p),
450
topic=_compute_topic(self.topic, ctxt, host, None),
413
topic=_compute_topic(self.topic, ctxt, host, None))
453
415
def run_instance(self, ctxt, instance, host, request_spec,
454
416
filter_properties, requested_networks,
460
422
requested_networks=requested_networks,
461
423
injected_files=injected_files, admin_password=admin_password,
462
424
is_first_time=is_first_time),
463
topic=_compute_topic(self.topic, ctxt, host, None),
425
topic=_compute_topic(self.topic, ctxt, host, None))
466
427
def set_admin_password(self, ctxt, instance, new_pass):
467
428
instance_p = jsonutils.to_primitive(instance)
468
429
return self.call(ctxt, self.make_msg('set_admin_password',
469
430
instance=instance_p, new_pass=new_pass),
470
topic=_compute_topic(self.topic, ctxt, None, instance),
431
topic=_compute_topic(self.topic, ctxt, None, instance))
473
433
def set_host_enabled(self, ctxt, enabled, host):
474
434
topic = _compute_topic(self.topic, ctxt, host, None)
478
438
def get_host_uptime(self, ctxt, host):
479
439
topic = _compute_topic(self.topic, ctxt, host, None)
480
return self.call(ctxt, self.make_msg('get_host_uptime'), topic,
440
return self.call(ctxt, self.make_msg('get_host_uptime'), topic)
483
442
def reserve_block_device_name(self, ctxt, instance, device):
484
443
instance_p = jsonutils.to_primitive(instance)
485
444
return self.call(ctxt, self.make_msg('reserve_block_device_name',
486
445
instance=instance_p, device=device),
487
topic=_compute_topic(self.topic, ctxt, None, instance),
446
topic=_compute_topic(self.topic, ctxt, None, instance))
490
448
def snapshot_instance(self, ctxt, instance, image_id, image_type,
491
449
backup_type, rotation):
494
452
instance=instance_p, image_id=image_id,
495
453
image_type=image_type, backup_type=backup_type,
496
454
rotation=rotation),
497
topic=_compute_topic(self.topic, ctxt, None, instance),
455
topic=_compute_topic(self.topic, ctxt, None, instance))
500
457
def start_instance(self, ctxt, instance):
501
458
instance_p = jsonutils.to_primitive(instance)
502
459
self.cast(ctxt, self.make_msg('start_instance',
503
460
instance=instance_p),
504
topic=_compute_topic(self.topic, ctxt, None, instance),
461
topic=_compute_topic(self.topic, ctxt, None, instance))
507
463
def stop_instance(self, ctxt, instance, cast=True):
508
464
rpc_method = self.cast if cast else self.call
509
465
instance_p = jsonutils.to_primitive(instance)
510
466
return rpc_method(ctxt, self.make_msg('stop_instance',
511
467
instance=instance_p),
512
topic=_compute_topic(self.topic, ctxt, None, instance),
468
topic=_compute_topic(self.topic, ctxt, None, instance))
515
470
def suspend_instance(self, ctxt, instance):
516
471
instance_p = jsonutils.to_primitive(instance)
517
472
self.cast(ctxt, self.make_msg('suspend_instance',
518
473
instance=instance_p),
519
topic=_compute_topic(self.topic, ctxt, None, instance),
474
topic=_compute_topic(self.topic, ctxt, None, instance))
522
476
def terminate_instance(self, ctxt, instance):
523
477
instance_p = jsonutils.to_primitive(instance)
524
478
self.cast(ctxt, self.make_msg('terminate_instance',
525
479
instance=instance_p),
526
topic=_compute_topic(self.topic, ctxt, None, instance),
480
topic=_compute_topic(self.topic, ctxt, None, instance))
529
482
def unpause_instance(self, ctxt, instance):
530
483
instance_p = jsonutils.to_primitive(instance)
531
484
self.cast(ctxt, self.make_msg('unpause_instance',
532
485
instance=instance_p),
533
topic=_compute_topic(self.topic, ctxt, None, instance),
486
topic=_compute_topic(self.topic, ctxt, None, instance))
536
488
def unrescue_instance(self, ctxt, instance):
537
489
instance_p = jsonutils.to_primitive(instance)
538
490
self.cast(ctxt, self.make_msg('unrescue_instance',
539
491
instance=instance_p),
540
topic=_compute_topic(self.topic, ctxt, None, instance),
492
topic=_compute_topic(self.topic, ctxt, None, instance))
544
495
class SecurityGroupAPI(nova.openstack.common.rpc.proxy.RpcProxy):