Remove BuildRequest.block_device_mapping clone workaround
This was originally added in change I60abcd4f27dc877c4e420071be77c9fdb697ad99 because we still created the BDMs in the API, and we did it based on the build_request.block_device_mapping set in the _provision_instances method. We had to workaround the fact that BuildRequest.create() would serialize the BDMs to store them in the DB, and then deserialize them to set them on the BuildRequest object field. As a result, the BuildRequest.block_device_mapping field was orphaned (it lost it's internal RequestContext). So later on when creating the BDMs from BuildRequest.block_device_mapping, the update_or_create() remotable call would fail since the object didn't have a context set. To workaround that we made a clone of the BlockDeviceMappingList when creating the BuildRequest and then set the original "dirty" list on the BuildRequest object which was used later to create the BDMs. In change I8742071b55f018f864f5a382de20075a5b444a79 we stopped creating the BDMs in the API service and started created them in the conductor service when calling schedule_and_build_instances. And the block_device_mapping list passed to that conductor method is the same one that we hacked into the BuildRequest object in the earlier change (for the same reason really). So at this point, we no longer need this confusing workaround and can remove it. Change-Id: I88e4d5cf38ee9ab4be9b8d7ae48bf273478fe3ef
This commit is contained in:
parent
0039231719
commit
14960061cc
@ -1034,15 +1034,11 @@ class API(base.Base):
|
||||
self._bdm_validate_set_size_and_instance(context,
|
||||
instance, instance_type, block_device_mapping))
|
||||
|
||||
# NOTE(danms): BDMs are still not created, so we need to pass
|
||||
# a clone and then reset them on our object after create so
|
||||
# that they're still dirty for later in this process
|
||||
build_request = objects.BuildRequest(context,
|
||||
instance=instance, instance_uuid=instance.uuid,
|
||||
project_id=instance.project_id,
|
||||
block_device_mappings=block_device_mapping.obj_clone())
|
||||
block_device_mappings=block_device_mapping)
|
||||
build_request.create()
|
||||
build_request.block_device_mappings = block_device_mapping
|
||||
|
||||
# Create an instance_mapping. The null cell_mapping indicates
|
||||
# that the instance doesn't yet exist in a cell, and lookups
|
||||
|
Loading…
Reference in New Issue
Block a user