Beispiel #1
0
 def test_api_storage_free_inconsistent(self):
     self.resp = [
         # Response for call to get node id
         [{
             'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
             'name': 'ubuntu'
         }],
         # Response for call to get node details
         {
             'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
             'name': 'ubuntu',
             'size': 30,
             'status': 'ACTIVE',
             'storage_free': 20,
             'storage_used': 9
         }
     ]
     result = audit.node(self.helper)
     self.assertEquals(
         result, {
             'node':
             '0ff84778-cdb8-4e5a-b897-f912641ca87c',
             'msg':
             "API 'storage_free' is inconsistent "
             "with storage node  (20 != 21)"
         })
Beispiel #2
0
    def audit_node(self):
        """
        Report any inconsistencies with node capacity
        and what the API reports about the capacity
        """
        helper = self.load_conf(self.config)
        first = audit.node(helper)
        if not first:
            return 0
        sleep(1)
        second = audit.node(helper)
        # If the results do not match, something must have
        # changed while we were sleeping
        if first != second:
            return self.audit_node()

        print "\n The Node failed to pass audit"
        self.display(first)
        return 1
Beispiel #3
0
    def audit_node(self):
        """
        Report any inconsistencies with node capacity
        and what the API reports about the capacity
        """
        helper = self.load_conf(self.config)
        first = audit.node(helper)
        if not first:
            return 0
        sleep(1)
        second = audit.node(helper)
        # If the results do not match, something must have
        # changed while we were sleeping
        if first != second:
            return self.audit_node()

        print "\n The Node failed to pass audit"
        self.display(first)
        return 1
Beispiel #4
0
 def test_no_problems(self):
     self.resp = [
         # Response for call to get node id
         [{
           'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
           'name': 'ubuntu'}],
         # Response for call to get node details
         {
          'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
          'name': 'ubuntu',
          'size': 30,
          'status': 'ACTIVE',
          'storage_free': 21,
          'storage_used': 9}
     ]
     self.assertEquals(audit.node(self.helper), None)
Beispiel #5
0
 def test_no_problems(self):
     self.resp = [
         # Response for call to get node id
         [{
           'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
           'name': 'ubuntu'}],
         # Response for call to get node details
         {
          'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
          'name': 'ubuntu',
          'size': 30,
          'status': 'ACTIVE',
          'storage_free': 21,
          'storage_used': 9}
     ]
     self.assertEquals(audit.node(self.helper), None)
Beispiel #6
0
 def test_api_size_inconsistent(self):
     self.resp = [
         # Response for call to get node id
         [{
           'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
           'name': 'ubuntu'}],
         # Response for call to get node details
         {
          'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
          'name': 'ubuntu',
          'size': 31,
          'status': 'ACTIVE',
          'storage_free': 21,
          'storage_used': 9}
     ]
     result = audit.node(self.helper)
     self.assertEquals(result, {
         'node': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
         'msg': "API 'size' is inconsistent with storage node (31 != 30)"})
Beispiel #7
0
 def test_storage_used_inconsistent(self):
     self.resp = [
         # Response for call to get node id
         [{
           'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
           'name': 'ubuntu'}],
         # Response for call to get node details
         {
          'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
          'name': 'ubuntu',
          'size': 30,
          'status': 'ACTIVE',
          'storage_free': 21,
          'storage_used': 8}
     ]
     result = audit.node(self.helper)
     self.assertEquals(result, {
         'node': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
         'msg': 'API storage_used is inconsistent with node (8 != 9)'})
Beispiel #8
0
 def test_storage_used_inconsistent(self):
     self.resp = [
         # Response for call to get node id
         [{
           'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
           'name': 'ubuntu'}],
         # Response for call to get node details
         {
          'id': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
          'name': 'ubuntu',
          'size': 30,
          'status': 'ACTIVE',
          'storage_free': 21,
          'storage_used': 8}
     ]
     result = audit.node(self.helper)
     self.assertEquals(result, {
         'node': '0ff84778-cdb8-4e5a-b897-f912641ca87c',
         'msg': 'API storage_used is inconsistent with node (8 != 9)'})