'Create a migration record for the upcoming resize.  This should
be done while the COMPUTE_RESOURCES_SEMAPHORE is held so the resource
claim will not be lost if the audit process starts.'

def _create_migration(self, context, instance, new_instance_type, nodename, move_type=None):

    migration = objects.Migration(context=context.elevated())
    migration.dest_compute = self.host
    migration.dest_node = nodename
    migration.dest_host = self.driver.get_host_ip_addr()
    migration.old_instance_type_id = instance.flavor.id
    migration.new_instance_type_id = new_instance_type.id
    migration.status = 'pre-migrating'
    migration.instance_uuid = instance.uuid
    migration.source_compute = instance.host
    migration.source_node = instance.node
    if move_type:
        migration.migration_type = move_type
    else:
        migration.migration_type = migration_obj.determine_migration_type(migration)
    migration.create()
    return migration
