def check_mapped_storage_exists(coriolis, destination_endpoint,
                                storage_mappings,
                                destination_environment=None):
    """ Checks whether all of the mapped storage types exist on the destination.

    :param destination_endpoint: destination endpoint object or ID
    :param storage_mappings: storage mappings dict
    :param destination_environment: optional environment options for target
    :raises: Exception if storage is not found.
    """
    storage = coriolis.endpoint_storage.list(
        destination_endpoint, environment=destination_environment)

    def _check_stor(storage_name_or_id):
        matches = [
            stor for stor in storage
            if stor.id == storage_name_or_id or stor.name == storage_name_or_id]
        if not matches:
            raise Exception(
                "Could not find storage type '%s' in: %s" % (
                    storage_name_or_id, storage))
        return matches[0]

    # check default:
    default = storage_mappings.get('default')
    if default is not None:
        _check_stor(default)

    # check backend mappings:
    for mapped_storage in storage_mappings.get('backend_mappings', {}).values():
        _check_stor(mapped_storage)

    # check per-disk mappings:
    for mapped_storage in storage_mappings.get('disk_mappings', {}).values():
        _check_stor(mapped_storage)