DC topology

From SambaWiki
Revision as of 13:36, 17 February 2010 by Cd1 (talk | contribs)

Introduction

This is a simpler version of the DC topology algorithm as described by Microsoft at http://msdn.microsoft.com/en-us/library/dd240043(PROT.13).aspx. The goal of this document is to give an overview of the original algorithm, which is rather large.

Main functions

CreateGraph

create an empty graph
sort the objectGUIDs in ascending order
for each id: objectGUIDs
    create a vertex with id and add it to the graph
end
return the new graph

CreateEdge

create an edge
set edge.ID to siteLink.objectGUID
for each site: siteLink.siteList
    append site.objectGUID to edge.VertexIDs
end
set edge.ReplInfo.Cost to siteLink.cost
set edge.ReplInfo.Options to siteLink.options
set edge.ReplInfo.Interval to siteLink.replInterval
if siteLink has schedule
    set edge.ReplInfo.schedule to siteLink.schedule
else
    set edge.ReplInfo.schedule to null
end
set edge.type to the corresponding interSiteTransport.objectGUID
mark edge as undirected
return the new edge

CreateAutoEdgeSet

create an edgeset
for each l: all siteLink objects
    find an edge in the graph such that its ID == l.objectGUID
    append l to the edgeset if edge.type = interSiteTransport.objectGUID
end
return the new edgeset

CreateEdgeSet

create an edgeset
set edgeset.ID to siteLinkBridge.objectGUID
for each l: objects with DN in siteLinkBridge.siteLinkList
    find an edge in the graph such that its ID == l.objectGUID
    append l to the edgeset if edge.type = interSiteTransport.objectGUID
end
return the new edgeset

SetupGraph

run CreateGraph based on the objectGUIDs of all the objects with objectClass=siteLink and children of the DN CN=Sites,CN=Configuration, and obtain a graph
for each t: objectClass=interSiteTransport, child of CN=Inter-Site Transports,CN=Sites,CN=Configuration
    store every objectClass=siteLink, child of t in L
    for each l: L
        run CreateEdge to create an edge based on l and add it to the graph
    end
    if t doesn't have NTDSTRANSPORT_OPT_BRIDGES_REQUIRED and the local site object doesn't have NTDSTRANSPORT_OPT_W2K3_BRIDGES_REQUIRED
        run CreateAutoEdgeSet to create an edgeset based on L and add it to the graph
    else
        for each b: objectClass=siteLinkBridge, child of t
            run CreateEdgeSet to create an edgeset based on b and add it to the graph
        end
    end
end
return the graph

ColorVertices

for each v: all graph vertices
    find a site such that its objectGUID == v.ID
    if the site contains one or more DCs with full replicas of the NC crossRef.nCName
        set v.Color to red
    else if the site contains one or more DCs with partial replicas of the NC crossRef.nCName
        set v.Color to black
    else
        set v.Color to white
    end
end
for each v: all graph vertices
    for each t: objectClass=interSiteTransport, child of CN=Inter-Site Transports,CN=Sites,CN=Configuration,DC=<domain>
        find a graph vertex such that its ID is the objectGUID of the local DC site
        if vertex.Color is red and t.name isn't "IP" and crossRef is a domain AD NC, or
        if the graph doesn't have any edge that contains v
            skip this iteration and continue the loop
        end
        run GetBridgeheadDC to find out if a bridgehead DC is available
        if there's no bridgehead DC currently available
            mark that a failed DC was found
            skip this iteration and continue the loop
        end
        add t to v.AcceptRedRed and to v.AcceptBlack
    end
end
return a boolean value indicating if some failed DC was found