'Create an entry in the DB for this new instance,
including any related table updates (such as security group,
etc).
This is called by the scheduler after a location for the
instance has been determined.
:param create_instance: Determines if the instance is created here or
just populated for later creation. This is done so that this code
can be shared with cellsv1 which needs the instance creation to
happen here. It should be removed and this method cleaned up when
cellsv1 is a distant memory.'

def create_db_entry_for_new_instance(self, context, instance_type, image, instance, security_group, block_device_mapping, num_instances, index, shutdown_terminate=False, create_instance=True):

    self._populate_instance_for_create(context, instance, image, index, security_group, instance_type, num_instances, shutdown_terminate)
    if create_instance:
        instance.create()
    return instance
