def accept_transfer(self, context, volume_id, new_user, new_project):
    utils.require_driver_initialized(self.driver)
    volume_ref = self.db.volume_get(context.elevated(), volume_id)
    model_update = self.driver.accept_transfer(context, volume_ref, new_user, new_project)
    if model_update:
        try:
            self.db.volume_update(context.elevated(), volume_id, model_update)
        except exception.CinderException:
            with excutils.save_and_reraise_exception():
                LOG.exception(_LE('Update volume model for transfer operation failed.'), resource=volume_ref)
                self.db.volume_update(context.elevated(), volume_id, {'status': 'error'})
    LOG.info(_LI('Transfer volume completed successfully.'), resource=volume_ref)
    return model_update
def accept_transfer(self, context, volume_id, new_user, new_project):
    utils.require_driver_initialized(self.driver)
    volume_ref = self.db.volume_get(context.elevated(), volume_id)
    model_update = self.driver.accept_transfer(context, volume_ref, new_user, new_project)
    if model_update:
        try:
            self.db.volume_update(context.elevated(), volume_id, model_update)
        except exception.CinderException:
            with excutils.save_and_reraise_exception():
                LOG.exception(_LE('Update volume model for transfer operation failed.'), resource=volume_ref)
                self.db.volume_update(context.elevated(), volume_id, {'status': 'error'})
    LOG.info(_LI('Transfer volume completed successfully.'), resource=volume_ref)
    return model_update