~gandelman-a/ubuntu/precise/nova/UCA_2012.2.1

« back to all changes in this revision

Viewing changes to nova/compute/rpcapi.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Soren Hansen
  • Date: 2012-09-07 17:49:53 UTC
  • mfrom: (1.1.61)
  • Revision ID: package-import@ubuntu.com-20120907174953-oapuvix1jxm830he
Tags: 2012.2~rc1~20120907.15996-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/nova-common.postinst: Drop nova_sudoers permission changing
  since we do it in the debian/rules. (LP: #995285)

[ Soren Hansen ]
* Update debian/watch to account for symbolically named tarballs and
  use newer URL.
* Fix Launchpad URLs in debian/watch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
               finish_revert_resize()
126
126
        1.43 - Add migrate_data to live_migration()
127
127
        1.44 - Adds reserve_block_device_name()
 
128
 
 
129
        2.0 - Remove 1.x backwards compat
 
130
        2.1 - Adds orig_sys_metadata to rebuild()
128
131
    '''
129
132
 
130
 
    BASE_RPC_API_VERSION = '1.0'
 
133
    BASE_RPC_API_VERSION = '2.1'
131
134
 
132
135
    def __init__(self):
133
136
        super(ComputeAPI, self).__init__(
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),
155
 
                version='1.8')
 
157
                topic=_compute_topic(self.topic, ctxt, None, instance))
156
158
 
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),
163
 
                version='1.9')
 
164
                topic=_compute_topic(self.topic, ctxt, None, instance))
164
165
 
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
 
                  version='1.36')
 
170
                  topic=_compute_topic(self.topic, ctxt, None, instance))
171
171
 
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),
182
 
                         version='1.10')
 
181
                                              ctxt, destination, None))
183
182
 
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),
190
 
                  version='1.11')
 
188
                  topic=_compute_topic(self.topic, ctxt, None, instance))
191
189
 
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),
200
 
                version='1.42')
 
197
                topic=_compute_topic(self.topic, ctxt, host, instance))
201
198
 
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),
207
 
                version='1.13')
 
203
                topic=_compute_topic(self.topic, ctxt, None, instance))
208
204
 
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),
216
 
                version='1.42')
 
211
                topic=_compute_topic(self.topic, ctxt, host, None))
217
212
 
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),
225
 
                version='1.42')
 
219
                topic=_compute_topic(self.topic, ctxt, host, None))
226
220
 
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),
232
 
                version='1.7')
 
225
                topic=_compute_topic(self.topic, ctxt, None, instance))
233
226
 
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),
248
 
                version='1.16')
 
240
                topic=_compute_topic(self.topic, ctxt, None, instance))
249
241
 
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),
255
 
                version='1.17')
 
246
                topic=_compute_topic(self.topic, ctxt, None, instance))
256
247
 
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),
281
 
                version='1.18')
 
271
                topic=_compute_topic(self.topic, ctxt, None, instance))
282
272
 
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),
288
 
                version='1.19')
 
277
                topic=_compute_topic(self.topic, ctxt, None, instance))
289
278
 
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),
297
 
                version='1.43')
 
285
                topic=_compute_topic(self.topic, ctxt, host, None))
298
286
 
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),
304
 
                version='1.5')
 
291
                topic=_compute_topic(self.topic, ctxt, None, instance))
305
292
 
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),
313
 
                version='1.20')
 
299
                _compute_topic(self.topic, ctxt, host, None))
314
300
 
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),
320
 
                version='1.21')
 
305
                topic=_compute_topic(self.topic, ctxt, None, instance))
321
306
 
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),
327
 
                version='1.22')
 
311
                topic=_compute_topic(self.topic, ctxt, None, instance))
328
312
 
329
313
    def pre_live_migration(self, ctxt, instance, block_migration, disk,
330
314
            host):
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),
335
 
                version='1.23')
 
318
                disk=disk), _compute_topic(self.topic, ctxt, host, None))
336
319
 
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),
345
 
                version='1.42')
 
327
                _compute_topic(self.topic, ctxt, host, None))
346
328
 
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),
352
 
                version='1.4')
 
333
                topic=_compute_topic(self.topic, ctxt, None, instance))
353
334
 
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),
362
 
                version='1.24')
 
341
                orig_image_ref=orig_image_ref,
 
342
                orig_sys_metadata=orig_sys_metadata),
 
343
                topic=_compute_topic(self.topic, ctxt, None, instance))
363
344
 
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))
367
348
 
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))
372
 
 
373
 
    def refresh_security_group_members(self, ctxt, security_group_id,
374
 
            host):
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))
378
 
 
379
349
    def remove_aggregate_host(self, ctxt, aggregate_id, host_param, host):
380
350
        '''Remove aggregate host.
381
351
 
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),
397
 
                version='1.25')
 
366
                topic=_compute_topic(self.topic, ctxt, None, instance))
398
367
 
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),
404
 
                version='1.26')
 
372
                topic=_compute_topic(self.topic, ctxt, host, None))
405
373
 
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),
412
 
                version='1.27')
 
379
                topic=_compute_topic(self.topic, ctxt, None, instance))
413
380
 
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),
419
 
                version='1.28')
 
385
                topic=_compute_topic(self.topic, ctxt, None, instance))
420
386
 
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,
428
 
                version='1.42')
 
393
                image=image, reservations=reservations), topic)
429
394
 
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),
435
 
                version='1.30')
 
399
                topic=_compute_topic(self.topic, ctxt, None, instance))
436
400
 
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),
444
 
                version='1.42')
 
407
                topic=_compute_topic(self.topic, ctxt, host, instance))
445
408
 
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),
451
 
            version='1.32')
 
413
            topic=_compute_topic(self.topic, ctxt, host, None))
452
414
 
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),
464
 
                version='1.39')
 
425
                topic=_compute_topic(self.topic, ctxt, host, None))
465
426
 
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),
471
 
                version='1.33')
 
431
                topic=_compute_topic(self.topic, ctxt, None, instance))
472
432
 
473
433
    def set_host_enabled(self, ctxt, enabled, host):
474
434
        topic = _compute_topic(self.topic, ctxt, host, None)
477
437
 
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,
481
 
                version='1.1')
 
440
        return self.call(ctxt, self.make_msg('get_host_uptime'), topic)
482
441
 
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),
488
 
                version='1.44')
 
446
                topic=_compute_topic(self.topic, ctxt, None, instance))
489
447
 
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),
498
 
                version='1.34')
 
455
                topic=_compute_topic(self.topic, ctxt, None, instance))
499
456
 
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),
505
 
                version='1.22')
 
461
                topic=_compute_topic(self.topic, ctxt, None, instance))
506
462
 
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),
513
 
                version='1.21')
 
468
                topic=_compute_topic(self.topic, ctxt, None, instance))
514
469
 
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),
520
 
                version='1.6')
 
474
                topic=_compute_topic(self.topic, ctxt, None, instance))
521
475
 
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),
527
 
                version='1.37')
 
480
                topic=_compute_topic(self.topic, ctxt, None, instance))
528
481
 
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),
534
 
                version='1.5')
 
486
                topic=_compute_topic(self.topic, ctxt, None, instance))
535
487
 
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),
541
 
                version='1.35')
 
492
                topic=_compute_topic(self.topic, ctxt, None, instance))
542
493
 
543
494
 
544
495
class SecurityGroupAPI(nova.openstack.common.rpc.proxy.RpcProxy):
548
499
 
549
500
        1.0 - Initial version.
550
501
        1.41 - Adds refresh_instance_security_rules()
 
502
 
 
503
        2.0 - Remove 1.x backwards compat
551
504
    '''
552
505
 
553
 
    BASE_RPC_API_VERSION = '1.0'
 
506
    BASE_RPC_API_VERSION = '2.0'
554
507
 
555
508
    def __init__(self):
556
509
        super(SecurityGroupAPI, self).__init__(
573
526
        self.cast(ctxt, self.make_msg('refresh_instance_security_rules',
574
527
                instance=instance_p),
575
528
                topic=_compute_topic(self.topic, ctxt, instance['host'],
576
 
                instance),
577
 
                version='1.41')
 
529
                instance))