def _changeState(self, state):
     timer.cancelAllByTag(tag=self)
     self._state = state
     if state in self.TIMEOUT:
         timer.scheduleIn(timeout=self.TIMEOUT[state], callback=self._timeout, tag=self)
     if self._stateChangeCallback is not None:
         self._stateChangeCallback(self)
Exemple #2
0
 def heartbeat(self):
     if self.dead():
         return
     timer.cancelAllByTag(tag=self)
     timer.scheduleIn(timeout=self._HEARTBEAT_TIMEOUT,
                      callback=self._heartbeatTimeout,
                      tag=self)
Exemple #3
0
 def _changeState(self, state):
     timer.cancelAllByTag(tag=self)
     self._state = state
     if state in self._TIMEOUT:
         timer.scheduleIn(timeout=self._TIMEOUT[state],
                          callback=self._timeout,
                          tag=self)
     if self._stateChangeCallback is not None:
         self._stateChangeCallback(self)
Exemple #4
0
 def _die(self, reason):
     assert not self.dead()
     logging.info("Allocation dies of '%(reason)s'", dict(reason=reason))
     for stateMachine in list(self._waiting.values()) + list(
             self._inaugurated.values()):
         stateMachine.unassign()
         stateMachine.setDestroyCallback(None)
         self._freePool.put(stateMachine)
     self._inaugurated = None
     self._death = dict(when=time.time(), reason=reason)
     timer.cancelAllByTag(tag=self)
     self._broadcaster.allocationChangedState(self._index)
 def _die(self, reason):
     assert not self.dead()
     logging.info("Allocation dies of '%(reason)s'", dict(reason=reason))
     if self._vms is not None:
         for name, vmInstance in self._vms.iteritems():
             if vmInstance.index() in self._allVMs:
                 del self._allVMs[vmInstance.index()]
             vmInstance.destroy()
         self._vms = None
     self._death = dict(when=time.time(), reason=reason)
     timer.cancelAllByTag(tag=self)
     self._broadcaster.allocationChangedState(self._index)
Exemple #6
0
 def _die(self, reason):
     assert not self.dead()
     logging.info("Allocation dies of '%(reason)s'", dict(reason=reason))
     if self._vms is not None:
         for name, vmInstance in self._vms.iteritems():
             if vmInstance.index() in self._allVMs:
                 del self._allVMs[vmInstance.index()]
             vmInstance.destroy()
         self._vms = None
     self._death = dict(when=time.time(), reason=reason)
     timer.cancelAllByTag(tag=self)
     self._broadcaster.allocationChangedState(self._index)
 def _die(self, reason):
     assert not self.dead()
     logging.info("Allocation %(idx)s dies of '%(reason)s'", dict(idx=self._index, reason=reason))
     for stateMachine in list(self._waiting.values()) + list(self._inaugurated.values()):
         if stateMachine.state() == hoststatemachine.STATE_DESTROYED:
             logging.info("State machine %(id)s was destroyed during the allocation's lifetime",
                          dict(id=stateMachine.hostImplementation().id()))
             continue
         self._returnHostToFreePool(stateMachine)
     self._inaugurated = None
     self._death = dict(when=time.time(), reason=reason)
     timer.cancelAllByTag(tag=self)
     self._broadcaster.allocationChangedState(self._index)
     self._broadcaster.cleanupAllocationPublishResources(self._index)
     logging.info("Allocation %(idx)s died.", dict(idx=self._index))
 def _inauguratorProgress(self, progress):
     if self._state not in [STATE_INAUGURATION_LABEL_PROVIDED, STATE_CHECKED_IN]:
         logging.error("Progress message in invalid state: %(state)s", dict(state=self._state))
         return
     if self._state == STATE_CHECKED_IN:
         return
     if 'state' not in progress or 'percent' not in progress:
         logging.error("Invalid progress message: %(progress)s", dict(progress=progress))
         return
     if progress['state'] != 'fetching':
         return
     if progress[u'percent'] != self._inaugurationProgressPercent:
         self._inaugurationProgressPercent = progress[u'percent']
         timer.cancelAllByTag(tag=self)
         timer.scheduleIn(timeout=self.TIMEOUT[STATE_INAUGURATION_LABEL_PROVIDED],
                          callback=self._timeout, tag=self)
 def heartbeat(self):
     if self.dead():
         return
     timer.cancelAllByTag(tag=self)
     timer.scheduleIn(timeout=self._HEARTBEAT_TIMEOUT, callback=self._heartbeatTimeout, tag=self)