@@ -519,7 +519,7 @@ def update_compute_provider_status(self, context, rp_uuid, enabled):
519
519
class ComputeManager (manager .Manager ):
520
520
"""Manages the running instances from creation to destruction."""
521
521
522
- target = messaging .Target (version = '5.1 ' )
522
+ target = messaging .Target (version = '5.2 ' )
523
523
524
524
def __init__ (self , compute_driver = None , * args , ** kwargs ):
525
525
"""Load configuration options and connect to the hypervisor."""
@@ -4148,7 +4148,7 @@ def _delete_allocation_after_move(self, context, instance, migration):
4148
4148
@wrap_instance_event (prefix = 'compute' )
4149
4149
@errors_out_migration
4150
4150
@wrap_instance_fault
4151
- def revert_resize (self , context , instance , migration ):
4151
+ def revert_resize (self , context , instance , migration , request_spec = None ):
4152
4152
"""Destroys the new instance on the destination machine.
4153
4153
4154
4154
Reverts the model changes, and powers on the old instance on the
@@ -4201,7 +4201,7 @@ def revert_resize(self, context, instance, migration):
4201
4201
4202
4202
# RPC cast back to the source host to finish the revert there.
4203
4203
self .compute_rpcapi .finish_revert_resize (context , instance ,
4204
- migration , migration .source_compute )
4204
+ migration , migration .source_compute , request_spec )
4205
4205
4206
4206
def _finish_revert_resize_network_migrate_finish (self , context , instance ,
4207
4207
migration ):
@@ -4251,7 +4251,8 @@ def _finish_revert_resize_network_migrate_finish(self, context, instance,
4251
4251
@wrap_instance_event (prefix = 'compute' )
4252
4252
@errors_out_migration
4253
4253
@wrap_instance_fault
4254
- def finish_revert_resize (self , context , instance , migration ):
4254
+ def finish_revert_resize (
4255
+ self , context , instance , migration , request_spec = None ):
4255
4256
"""Finishes the second half of reverting a resize on the source host.
4256
4257
4257
4258
Bring the original source instance state back (active/shutoff) and
@@ -4383,7 +4384,8 @@ def _revert_allocation(self, context, instance, migration):
4383
4384
return True
4384
4385
4385
4386
def _prep_resize (self , context , image , instance , instance_type ,
4386
- filter_properties , node , migration , clean_shutdown = True ):
4387
+ filter_properties , node , migration , request_spec ,
4388
+ clean_shutdown = True ):
4387
4389
4388
4390
if not filter_properties :
4389
4391
filter_properties = {}
@@ -4424,7 +4426,7 @@ def _prep_resize(self, context, image, instance, instance_type,
4424
4426
# RPC cast to the source host to start the actual resize/migration.
4425
4427
self .compute_rpcapi .resize_instance (
4426
4428
context , instance , claim .migration , image ,
4427
- instance_type , clean_shutdown )
4429
+ instance_type , request_spec , clean_shutdown )
4428
4430
4429
4431
def _send_prep_resize_notifications (
4430
4432
self , context , instance , phase , flavor ):
@@ -4491,7 +4493,8 @@ def prep_resize(self, context, image, instance, instance_type,
4491
4493
try :
4492
4494
self ._prep_resize (context , image , instance ,
4493
4495
instance_type , filter_properties ,
4494
- node , migration , clean_shutdown )
4496
+ node , migration , request_spec ,
4497
+ clean_shutdown )
4495
4498
except Exception :
4496
4499
# Since we hit a failure, we're either rescheduling or dead
4497
4500
# and either way we need to cleanup any allocations created
@@ -4583,21 +4586,23 @@ def _reschedule_resize_or_reraise(self, context, instance, exc_info,
4583
4586
@wrap_instance_event (prefix = 'compute' )
4584
4587
@wrap_instance_fault
4585
4588
def resize_instance (self , context , instance , image ,
4586
- migration , instance_type , clean_shutdown ):
4589
+ migration , instance_type , clean_shutdown ,
4590
+ request_spec = None ):
4587
4591
"""Starts the migration of a running instance to another host.
4588
4592
4589
4593
This is initiated from the destination host's ``prep_resize`` routine
4590
4594
and runs on the source host.
4591
4595
"""
4592
4596
try :
4593
4597
self ._resize_instance (context , instance , image , migration ,
4594
- instance_type , clean_shutdown )
4598
+ instance_type , clean_shutdown , request_spec )
4595
4599
except Exception :
4596
4600
with excutils .save_and_reraise_exception ():
4597
4601
self ._revert_allocation (context , instance , migration )
4598
4602
4599
4603
def _resize_instance (self , context , instance , image ,
4600
- migration , instance_type , clean_shutdown ):
4604
+ migration , instance_type , clean_shutdown ,
4605
+ request_spec ):
4601
4606
with self ._error_out_instance_on_exception (context , instance ), \
4602
4607
errors_out_migration_ctxt (migration ):
4603
4608
network_info = self .network_api .get_instance_nw_info (context ,
@@ -4643,7 +4648,8 @@ def _resize_instance(self, context, instance, image,
4643
4648
4644
4649
# RPC cast to the destination host to finish the resize/migration.
4645
4650
self .compute_rpcapi .finish_resize (context , instance ,
4646
- migration , image , disk_info , migration .dest_compute )
4651
+ migration , image , disk_info , migration .dest_compute ,
4652
+ request_spec )
4647
4653
4648
4654
self ._send_resize_instance_notifications (
4649
4655
context , instance , bdms , network_info ,
@@ -4835,7 +4841,7 @@ def _finish_resize(self, context, instance, migration, disk_info,
4835
4841
@errors_out_migration
4836
4842
@wrap_instance_fault
4837
4843
def finish_resize (self , context , disk_info , image , instance ,
4838
- migration ):
4844
+ migration , request_spec = None ):
4839
4845
"""Completes the migration process.
4840
4846
4841
4847
Sets up the newly transferred disk and turns on the instance at its
@@ -5353,7 +5359,7 @@ def _shelve_offload_instance(self, context, instance, clean_shutdown,
5353
5359
@wrap_instance_event (prefix = 'compute' )
5354
5360
@wrap_instance_fault
5355
5361
def unshelve_instance (self , context , instance , image ,
5356
- filter_properties , node ):
5362
+ filter_properties , node , request_spec = None ):
5357
5363
"""Unshelve the instance.
5358
5364
5359
5365
:param context: request context
@@ -5362,6 +5368,8 @@ def unshelve_instance(self, context, instance, image,
5362
5368
volume backed instance.
5363
5369
:param filter_properties: dict containing limits, retry info etc.
5364
5370
:param node: target compute node
5371
+ :param request_spec: the RequestSpec object used to schedule the
5372
+ instance
5365
5373
"""
5366
5374
if filter_properties is None :
5367
5375
filter_properties = {}
0 commit comments