#
# Faiyaz Ahmed <faiyaza@cs.princeton.edu>
#
-# $Id: $
+# $Id: emailTxt.py,v 1.4 2006/11/14 19:20:13 faiyaza Exp $
#
Thanks.
+ -- PlanetLab Central (support@planet-lab.org)
+""")
+
+
+ removedSliceCreation=("""PlanetLab slice creation/renewal suspension.""","""As part of PlanetLab node monitoring, we noticed the %(loginbase)s site has less than 2 nodes up. We have attempted to contact the PI and Technical contacts multiple times and have not received a response.
+
+Slice creation and renewal are now suspended for the %(loginbase)s site. Please be aware that failure to respond will result in the automatic suspension of all running slices on PlanetLab.
+
+
+ -- PlanetLab Central (support@planet-lab.org)
+""")
+
+ suspendSlices=("""PlanetLab slices suspended.""","""As part of PlanetLab node monitoring, we noticed the %(loginbase)s site has less than 2 nodes up. We have attempted to contact the PI and Technical contacts multiple times and have not received a response.
+
+All %(loginbase)s slices are now suspended.
+
+
-- PlanetLab Central (support@planet-lab.org)
""")
POLSLEEP = 7200
# Where to email the summary
-#SUMTO = "pupadm@lists.planet-lab.org"
-SUMTO = "faiyaza@cs.princeton.edu"
+SUMTO = "pupadm@lists.planet-lab.org"
TECHEMAIL="tech-%s@sites.planet-lab.org"
PIEMAIL="pi-%s@sites.planet-lab.org"
SLICEMAIL="%s@slices.planet-lab.org"
target.append(PIEMAIL % loginbase)
#remove slice creation if enough nodes arent up
if not self.enoughUp(loginbase):
+ slices = plc.slices(loginbase)
+ if len(slices) >= 1:
+ for slice in slices:
+ target.append(SLICEMAIL % slice)
logger.info("POLICY: Removing slice creation from %s" % loginbase)
+ tmp = emailTxt.mailtxt.removedSliceCreation
+ sbj = tmp[0]
+ msg = tmp[1] % {'loginbase': loginbase}
plc.removeSliceCreation(node)
+ mailer.email(sbj, msg, target)
self.squeezed[loginbase] = (time.time(), "creation")
+ return
+
# If more than PI thresh and slicethresh
if (delta >= PITHRESH) and (delta > SLICETHRESH):
+ target.append(PIEMAIL % loginbase)
# Email slices at site.
slices = plc.slices(loginbase)
if len(slices) >= 1:
for slice in slices:
target.append(SLICEMAIL % slice)
- if not self.enoughUp(loginbase):
- plc.suspendSlices(node)
- self.squeezed[loginbase] = (time.time(),
- "freeze")
+ # If not enough up, freeze slices and email everyone.
+ if not self.enoughUp(loginbase):
+ logger.info("POLICY: Suspending %s slices." % loginbase)
+ tmp = emailTxt.mailtxt.suspendSlices
+ sbj = tmp[0]
+ msg = tmp[1] % {'loginbase': loginbase}
+ plc.suspendSlices(node)
+ self.squeezed[loginbase] = (time.time(), "freeze")
+ mailer.email(sbj, msg, target)
+ return
# Find the bucket the node is in and send appropriate email
# to approriate list of people.