def assign_default_storage_policy_to_datastore(profile_manager, policy,
                                               datastore):
    '''
    Assigns a storage policy as the default policy to a datastore.

    profile_manager
        Reference to the profile manager.

    policy
        Reference to the policy to assigned.

    datastore
        Reference to the datastore.
    '''
    placement_hub = pbm.placement.PlacementHub(
        hubId=datastore._moId, hubType='Datastore')
    log.trace('placement_hub = %s', placement_hub)
    try:
        profile_manager.AssignDefaultRequirementProfile(policy.profileId,
                                                        [placement_hub])
    except vim.fault.NoPermission as exc:
        log.exception(exc)
        raise VMwareApiError('Not enough permissions. Required privilege: '
                             '{0}'.format(exc.privilegeId))
    except vim.fault.VimFault as exc:
        log.exception(exc)
        raise VMwareApiError(exc.msg)
    except vmodl.RuntimeFault as exc:
        log.exception(exc)
        raise VMwareRuntimeError(exc.msg)