mirror of
https://github.com/samba-team/samba.git
synced 2025-03-20 22:50:26 +03:00
kcc_utils: Keep a count of the DCs in each site
This is useful for ranking which sites are preferable within the same site link. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
32a5431987
commit
96340e1ad2
@ -31,6 +31,7 @@ from samba.dcerpc import (
|
||||
)
|
||||
from samba.common import dsdb_Dn
|
||||
from samba.ndr import ndr_unpack, ndr_pack
|
||||
from collections import Counter
|
||||
|
||||
|
||||
class KCCError(Exception):
|
||||
@ -2284,11 +2285,11 @@ def uncovered_sites_to_cover(samdb, site_name):
|
||||
scope=ldb.SCOPE_SUBTREE,
|
||||
expression="(objectClass=site)")
|
||||
|
||||
sites_in_use = set()
|
||||
sites_in_use = Counter()
|
||||
|
||||
# Assume server is of form DC,Servers,Site-ABCD because of schema
|
||||
for msg in server_res:
|
||||
sites_in_use.add(msg.dn.parent().parent().canonical_str())
|
||||
sites_in_use[msg.dn.parent().parent().canonical_str()] += 1
|
||||
|
||||
if len(sites_in_use) != len(site_res):
|
||||
# There is a possible uncovered site
|
||||
|
Loading…
x
Reference in New Issue
Block a user