Automatic package server assignment aims to assign packages to sites as required in order to distribute the package to all parties which are assigned the package to download. It also adds support to have these assignments removed automatically after they have not been used for a specified number of days.
parately to allow the un-setting of manual assignments to sites. Automatic assignments to sites are only ever unset by the automatic un-assignment schedule.
The current set of automatic assignments is the collection of sites which contain computers which are set to receive the package. This is determined in a series of steps.
These resource targets contain the computers which are set to receive the package. This set of computers then has their IP addresses retrieved and the set of sites which are the closest encompassing sites for any of the IP addresses in the collection is created. This set of sites contains the sites which are to be automatically assigned. This process takes place in SWDSupport.SetPackageServerAssignment.
Specifically if any of the computers are in a resource target assigned to a site or site server, then that site or the site which contains that site server is used instead of the site which contains the computers IP address. Resource target assignment to an internet site does not override the IP address behaviour of a computer when it is not in the internet site.
Every package is always assigned to any sites which contain the SMP server.
Every package is always assigned to Default Internet Site.
In case no sites are defined (except Default Internet Site) every package is always assigned to ALL package servers
The database stored procedure spSetPackageServers stored procedure takes care of updating the database to match the package server assignment. It receives both the set of automatic assignments chosen and the manually assigned sites. Sites which have previously been automatically assigned are added to the automatic assignments group passed to the stored procedure. This allows the addition of 'manual' automatic assignments.
The stored procedure first removes all manually assigned sites from the list of automatically assigned sites. This gives manually assigned sites precedence. Then all sites which have been previously been automatically assigned are removed from the list to be automatically assigned. This is done by checking the package site activity log which has an entry added to it when assignment first occurs, and when subsequent requests come in from agents in a site requesting a package. All package site assignments which were manually assigned for the current package are then removed. The new manual assignments are then added back in, except ones which already have a corresponding pre-existing automatic assignment. The new automatic assignments are then added in unless there is already a manual assignment.
All new automatic assignments then have initial entries added to the package site activity log where there are currently no entries at all. Once that is completed the process of determining package servers which receive packages is the same as for the manually assignment to sites case. The distinct set of package servers associated with all assigned sites is obtained and all of those package servers are assigned as if individual assignment was selected.
In addition the standard automatic assignment process there is automatic assignment as required. This is triggered when a request comes in to GetPackageInfo which receives no download locations. If there are no download locations and the package has automatic assignment set then an automatic assignment between the client's closest sites and the package is added. This assignment is forced, that is it is added even if there are entries in the package site activity log. This allows automatic package assignment after automatic un-assignment has occurred. Once added to SWDPackageSite table the standard assignment process is followed. This takes place within spForceAutoAssignPackageSite stored procedure.
Automatic un-assignment is the process of removing package site assignments when they have not been used for a period of time. This is performed on a schedule which runs daily. The package site activity log is checked for each package assigned to a site and for each site where there has been no activity in greater then N days, automatic assignments to the site are removed. The activity log is unchanged by this, which stops automatic assignment from automatically re-assigning the package next time assignments are updated. The assignment can still be recreated, but only by the assignment as required which bypasses the activity log check.