opsi manual opsi version 4.0.2 - opsi Download - uib
opsi manual opsi version 4.0.2 - opsi Download - uib
opsi manual opsi version 4.0.2 - opsi Download - uib
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>opsi</strong> <strong>manual</strong> <strong>opsi</strong> <strong>version</strong> <strong>4.0.2</strong><br />
17.6 Processing<br />
133 / 193<br />
If the dynamic depot assignment is activated for a client by the host parameter clientconfig.depot.dynamic, the client<br />
retrieves the script via web service and executes it.<br />
The script to be used for dynamic assignment is:<br />
/etc/<strong>opsi</strong>/backendManager/extend.d/70_dynamic_depot.conf<br />
Following parameters are passed to the function selectDepot, which is defined in the script:<br />
• clientConfig<br />
Information about the current client configuration (hash).<br />
The clientConfig hash keys are currently:<br />
– "clientId": <strong>opsi</strong> host ID of the client (FQDN)<br />
– "ipAddress": IP address of the network interface to the <strong>opsi</strong>-config-server<br />
– "netmask" : netmask of the network interface<br />
– "defaultGateway": default gateway<br />
• masterDepot<br />
Information regarding the master depot (<strong>opsi</strong>-depot-server-object). The master depot is the depot which the client<br />
is assigned to from the management interface. The attributes of the passed <strong>opsi</strong>-depot-server-object match the<br />
attributes as given by host_getObjects (see Section 17.4).<br />
• alternativeDepots<br />
Information about the alternative depots (list of <strong>opsi</strong>-depot-server-objects). The list of alternative depots lists the<br />
depots, which are, regarding the required software packets, identical to the master depot.<br />
Based on this information, the assignment algorithm can pick a depot from the provided depot list and return the<br />
<strong>opsi</strong>-depot-server-object of the chosen depot as the result of the function. If the assignment algorithm does not find a<br />
suitable depot from the list (or if the provided list is empty), the return result should be the master depot object.<br />
17.7 Template of the assignment script<br />
The template script checks the network addresses of the given depots and picks the depot which is in the same network<br />
as the client.<br />
The template script offers example functions for depot detection.<br />
The function depotSelectionAlgorithmByNetworkAddress checks the network addresses of the depots and selects<br />
the depot which is in the same network as the client.<br />
The function depotSelectionAlgorithmByLatency sends ICMP „echo-request“-packets (ping) to the depots and<br />
selects the depot with the lowest latency.<br />
The function getDepotSelectionAlgorithm is called by the client and returns the algorithm for depot selection.<br />
The template script uses as default the function depotSelectionAlgorithmByNetworkAddress.<br />
# -*- coding: utf-8 -*-<br />
global depotSelectionAlgorithmByNetworkAddress<br />
depotSelectionAlgorithmByNetworkAddress = \<br />
’’’<br />
def selectDepot(clientConfig, masterDepot, alternativeDepots=[]):<br />
selectedDepot = masterDepot<br />
logger.info(u"Choosing depot from list of depots:")<br />
logger.info(u" Master depot: %s" % masterDepot)<br />
for alternativeDepot in alternativeDepots:<br />
logger.info(u" Alternative depot: %s" % alternativeDepot)<br />
if alternativeDepots:<br />
import socket, struct<br />
# Calculate bitmask of host’s ipaddress