Download Model-driven Distributed Software Deployment

Transcript
Atomic upgrading
7.5 Transition by compilation
transitionByCompilation(newDistributionExport, currentDistributionExport) :
N ← importDistributionExport(newDistributionExport)
O ← {}
if currentDistributionExport 6= ε :
O ← importDistributionExport(currentDistributionExport)
I ← O∩N
deactivateDrvs ← O − I
activateDrvs ← N − I
for each a ∈ activateDrvs :
copyClosure(a.service, a.targetEPR)
deactivate ← {}
activate ← {}
for each d ∈ deactivateDrvs :
result ← realise(d.service, d.targetEPR)
deactivate ← deactivate ∪ result
for each a ∈ activateDrvs :
result ← realise(a.service, a.targetEPR)
activate ← activate ∪ result
if lock(disnixInterface) = 0 :
for each d ∈ deactivate :
deactivate(d.targetEPR, d.service)
for each d ∈ deactivate :
uninstall(d.targetEPR, d.service)
for each a ∈ activate :
install(a.targetEPR, a.service)
for each a ∈ activate :
activate(a.targetEPR, a.service)
unlock(disnixInterface)
Figure 7.3: transitionByCompilation: Transition to a new deployment state by compiling
packages on the target machines
target machine. Finally the packages are activated in the Nix profile of the target machines.
In the commit-request or distribution phase the derivations in the distribution model are
instantiated and result in a set of store derivation files in the Nix store on the machine of the
coordinator.
Once all services have been instantiated, the distribution function decides what store
derivation to distribute to which target machine by calculating the intersection of the outputs
of the current and the previous distribution. The closures of these store derivations under
the intra-dependency relation are transferred to the machines in the network through the
Disnix interface. After receiving the store derivations, the interface will import the store
derivations in the Nix store on the target machine. After receiving all the store derivation
files, the compilation of the services will be started on the target machines. This part of the
83