23.9 VM Service Example

This section describes how to set up a VM with two storage mounts. The scripts referenced in the code samples are examples and not shipped with Moab.

#The VM-tracking job
JOBCFG[VMTracking]  FLAGS=VMTRACKING SELECT=TRUE
JOBCFG[VMTracking]  TEMPLATEDEPEND=AFTEROK:VMSetup
JOBCFG[VMTracking]  DESTROYTEMPLATE=VMDestroy
 
JOBCFG[VMSetup]  GENERICSYSJOB=TRUE
JOBCFG[VMSetup]  INHERITRES=TRUE
JOBCFG[VMSetup]  TRIGGER=EType=start,AType=exec,Action="$HOME/vm.py $MASTERHOST $*.SM",flags=objectxmlstdin,timeout=5:00,sets=^VMID
 
#This is VMID, not *.VMID, because it put directly into the VMTracking workflow (same is true for storageDestroy below)
JOBCFG[VMDestroy]  GENERICSYSJOB=TRUE
JOBCFG[VMDestroy]  TRIGGER=EType=start,AType=exec,Action="$HOME/destroy.py $VMID",timeout=5:00
 
#Storage jobs
JOBCFG[storage]  FLAGS=NORMSTART,GRESONLY SELECT=TRUE
JOBCFG[storage]  WALLTIME=INFINITY
JOBCFG[storage]  TEMPLATEDEPEND=AFTEROK:storageSetup
JOBCFG[storage]  DESTROYTEMPLATE=storageDestroy
 
JOBCFG[storageSetup] GENERICSYSJOB=TRUE FLAGS=NORMSTART,GRESONLY
JOBCFG[storageSetup] INHERITRES=TRUE
JOBCFG[storageSetup] TRIGGER=EType=start,AType=exec,Action="$HOME/storage.py",flags=objectxmlstdin,timeout=5:00,sets=^SM
 
JOBCFG[storageDestroy] GENERICSYSJOB=TRUE SELECT=TRUE
JOBCFG[storageDestroy] TRIGGER=EType=start,AType=exec,Action="$HOME/removeStorage.py $SM",timeout=5:00

The moab.cfg configuration above contains two service workflow templates: VM and storage. Each workflow is comprised of three jobs: a setup job, a submit/tracking job, and a destroy job. The destroy jobs retrieve variables containing their respective service's location and run a script to destroy their respective workflows.

The following image illustrates how the templates above will work together when one VMTracking and two storage jobs are requested as part of a service in a single VC:

To put the workflows together like the service illustrated above, you would first need to create the top layer VC (vc1).

> mvcctl -c
VC 'vc1' created

You would then submit the two storage mounts by creating two of the storage jobs and placing them inside of vc1.

> msub -l walltime=1:00:00,gres=gold:50,flags=gresonly,template=storage -W x="vc=vc1" job.sh --xml
vc2
> msub -l walltime=1:00:00,gres=silver:100,flags=gresonly,template=storage -W x="vc=vc1" job.sh --xml
vc3

Finally, you would request the VMTracking job and place it into vc1, indicating its dependencies on the storage VCs. Since these are being pulled from the uppermost VC, their namespaces will be applied and must be specified (vc2.SM and vc3.SM).

> msub -l walltime=INFINITY,template=VMTracking,os=rhel51,depend=set:vc3.SM:vc2.SM -W x="vc=vc1" -W x="trigns=vc1,vc2" -W x="var=VMID=myvm" job.sh --xml
vc4

Copyright © 2012 Adaptive Computing Enterprises, Inc.®