Beispiel #1
0
 def getStatus(self):
     try:
         if self._mom.ping():
             return 'active'
         else:
             return 'inactive'
     except (AttributeError, socket.error):
         throttledlog.warning('MomNotAvailable', "MOM not available.")
         return 'inactive'
Beispiel #2
0
 def getStatus(self):
     try:
         if self._mom.ping():
             return 'active'
         else:
             return 'inactive'
     except (AttributeError, socket.error):
         throttledlog.warning('MomNotAvailable', "MOM not available.")
         return 'inactive'
Beispiel #3
0
 def getStatus(self):
     try:
         if self._mom.ping():
             return 'active'
         else:
             return 'inactive'
     except (ThrottledClient.Inactive, AttributeError, socket.error) as e:
         throttledlog.warning('MomNotAvailable',
                              "MOM not available. Error: %s", str(e))
         return 'inactive'
Beispiel #4
0
 def _dispatch(self):
     """
     Send `func' to Executor to be run as soon as possible.
     """
     state = None
     self._call = None
     try:
         self._executor.dispatch(self, self._timeout, discard=self._discard)
     except exception.ResourceExhausted:
         self._log.warning('could not run %s, executor queue full',
                           self._func)
         state = repr(self._executor)
     finally:
         if not self._exclusive:
             self._reschedule()
     if state:
         throttledlog.warning(self._name, 'executor state: %s', state)
Beispiel #5
0
 def _dispatch(self):
     """
     Send `func' to Executor to be run as soon as possible.
     """
     state = None
     self._call = None
     dispatched = False
     try:
         self._executor.dispatch(self, self._timeout, discard=self._discard)
         dispatched = True
     except exception.ResourceExhausted:
         self._log.warning('could not run %s, executor queue full',
                           self._func)
         state = repr(self._executor)
     finally:
         if not self._exclusive or not dispatched:
             self._reschedule()
     if state:
         throttledlog.warning(self._name, 'executor state: %s', state)
Beispiel #6
0
    def getKsmStats(self):
        """
        Get information about KSM and convert memory data from page
        based values to MiB.
        """

        ret = {}

        try:
            stats = self._mom.getStatistics()['host']
            ret['ksmState'] = bool(stats['ksm_run'])
            ret['ksmPages'] = stats['ksm_pages_to_scan']
            ret['ksmMergeAcrossNodes'] = bool(stats['ksm_merge_across_nodes'])
            ret['memShared'] = stats['ksm_pages_sharing'] * PAGE_SIZE_BYTES
            ret['memShared'] //= Mbytes
            ret['ksmCpu'] = stats['ksmd_cpu_usage']
        except (AttributeError, socket.error):
            throttledlog.warning(
                'MomNotAvailableKSM', "MOM not available, "
                "KSM stats will be missing.")

        return ret
Beispiel #7
0
    def getKsmStats(self):
        """
        Get information about KSM and convert memory data from page
        based values to MiB.
        """

        ret = {}

        try:
            stats = self._mom.getStatistics()['host']
            ret['ksmState'] = bool(stats['ksm_run'])
            ret['ksmPages'] = stats['ksm_pages_to_scan']
            ret['ksmMergeAcrossNodes'] = bool(stats['ksm_merge_across_nodes'])
            ret['memShared'] = stats['ksm_pages_sharing'] * PAGE_SIZE_BYTES
            ret['memShared'] //= Mbytes
            ret['ksmCpu'] = stats['ksmd_cpu_usage']
        except (AttributeError, socket.error):
            throttledlog.warning('MomNotAvailableKSM',
                                 "MOM not available, "
                                 "KSM stats will be missing.")

        return ret
Beispiel #8
0
 def test_logging_warning(self):
     throttledlog.throttle('test', 4)
     for i in range(7):
         throttledlog.warning('test', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: 0', 'Cycle: 4'])
 def test_logging_warning(self):
     throttledlog.throttle('test', 4)
     for i in range(7):
         throttledlog.warning('test', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: 0', 'Cycle: 4'])