'Returns a sorted list of jobs (dictionaries) that specify the
partitions, nodes, etc to be rsynced.
:param override_devices: if set, only jobs on these devices
will be returned
:param override_partitions: if set, only jobs on these partitions
will be returned
:param override_policies: if set, only jobs in these storage
policies will be returned'

def collect_jobs(self, override_devices=None, override_partitions=None, override_policies=None):

    jobs = []
    ips = whataremyips(self.bind_ip)
    for policy in POLICIES:
        next_part_power = getattr(policy.object_ring, 'next_part_power', None)
        if (next_part_power is not None):
            self.logger.warning(_("next_part_power    set    in    policy    '%s'.    Skipping"), policy.name)
            continue
        if (policy.policy_type == REPL_POLICY):
            if ((override_policies is not None) and (str(policy.idx) not in override_policies)):
                continue
            self.load_object_ring(policy)
            jobs += self.build_replication_jobs(policy, ips, override_devices=override_devices, override_partitions=override_partitions)
    random.shuffle(jobs)
    if self.handoffs_first:
        jobs.sort(key=(lambda job: (not job['delete'])))
    self.job_count = len(jobs)
    return jobs
