Move checks from bwmon for running limits before calling bwlimit.
[nodemanager.git] / accounts.py
index 09c8eed..c5ae7a4 100644 (file)
@@ -106,6 +106,8 @@ class Worker:
         self._acct = None  # the account object currently associated with this worker
 
     def ensure_created(self, rec, startingup = Startingup):
+        """Check account type is still valid.  If not, recreate sliver.  If still valid,
+        check if running and configure/start if not."""
         curr_class = self._get_class()
         next_class = type_acct_class[rec['type']]
         if next_class != curr_class:
@@ -114,16 +116,18 @@ class Worker:
             try: next_class.create(self.name, rec['vref'])
             finally: self._create_sem.release()
         if not isinstance(self._acct, next_class): self._acct = next_class(rec)
-        else: self._acct.configure(rec)
         if startingup or \
           not self.is_running() or \
           next_class != curr_class or \
           self._acct.initscriptchanged:
-            self._acct.start()
+            self.start(rec)
+        else: self._acct.configure(rec)
 
     def ensure_destroyed(self): self._destroy(self._get_class())
 
-    def start(self, d): self._acct.start(delay=d)
+    def start(self, rec, d = 0): 
+        self._acct.configure(rec)
+        self._acct.start(delay=d)
 
     def stop(self): self._acct.stop()