Esempio n. 1
0
 def main(self):
     req = DescribeServices.from_other(self, ListAll=True)
     services = req.main().get('serviceStatuses') or []
     nodes = {}
     for service in services:
         svcid = service['serviceId']
         if svcid.get('type') == 'node':
             nodes[svcid.get('name')] = {
                 'zone': svcid.get('partition'),
                 'host': svcid.get('host'),
                 'state': service.get('localState'),
                 'details': service.get('details') or {},
                 'instances': {}
             }
     req = DescribeInstances.from_other(self,
                                        service=self.args['ec2_service'],
                                        InstanceId=['verbose'])
     reservations = req.main().get('reservationSet')
     for reservation in reservations:
         for instance in reservation.get('instancesSet') or []:
             inst_info = {}
             for tag in instance.get('tagSet') or []:
                 if tag['key'] == 'euca:node' and tag['value'] in nodes:
                     node = nodes[tag['value']]
                     node['instances'][instance['instanceId']] = inst_info
                 elif tag['key'] == 'euca:node:migration:destination':
                     inst_info['migration_dest'] = tag['value']
                 # 'euca:node:migration:source' also exists
     return nodes
 def main(self):
     req = DescribeServices.from_other(self, ListAll=True)
     services = req.main().get('serviceStatuses') or []
     nodes = {}
     for service in services:
         svcid = service['serviceId']
         if svcid.get('type') == 'node':
             nodes[svcid.get('name')] = {
                 'zone': svcid.get('partition'),
                 'host': svcid.get('host'),
                 'state': service.get('localState'),
                 'details': service.get('details') or {},
                 'instances': {}}
     req = DescribeInstances.from_other(self, service=self.args['ec2_service'],
                                        InstanceId=['verbose'])
     reservations = req.main().get('reservationSet')
     for reservation in reservations:
         for instance in reservation.get('instancesSet') or []:
             inst_info = {}
             for tag in instance.get('tagSet') or []:
                 if tag['key'] == 'euca:node' and tag['value'] in nodes:
                     node = nodes[tag['value']]
                     node['instances'][instance['instanceId']] = inst_info
                 elif tag['key'] == 'euca:node:migration:destination':
                     inst_info['migration_dest'] = tag['value']
                 # 'euca:node:migration:source' also exists
     return nodes
 def main(self):
     req = DescribeServices.from_other(self, ListAll=True)
     services = req.main().get("serviceStatuses") or []
     nodes = {}
     for service in services:
         svcid = service["serviceId"]
         if svcid.get("type") == "node":
             nodes[svcid.get("name")] = {
                 "zone": svcid.get("partition"),
                 "host": svcid.get("host"),
                 "state": service.get("localState"),
                 "details": service.get("details") or {},
                 "instances": {},
             }
     req = DescribeInstances.from_other(self, service=self.args["ec2_service"], InstanceId=["verbose"])
     reservations = req.main().get("reservationSet")
     for reservation in reservations:
         for instance in reservation.get("instancesSet") or []:
             inst_info = {}
             for tag in instance.get("tagSet") or []:
                 if tag["key"] == "euca:node" and tag["value"] in nodes:
                     node = nodes[tag["value"]]
                     node["instances"][instance["instanceId"]] = inst_info
                 elif tag["key"] == "euca:node:migration:destination":
                     inst_info["migration_dest"] = tag["value"]
                 # 'euca:node:migration:source' also exists
     return nodes
Esempio n. 4
0
 def main(self):
     req = DescribeServices.from_other(
         self, ListAll=True, ShowEvents=True,
         ShowEventStacks=self.args.get('show_stack_traces'))
     result = req.main()
     events = []
     for service in result.get('serviceStatuses') or []:
         for r_event in service.get('statusDetails') or []:
             event = Event.from_status_detail(r_event)
             event.subject_type = service['serviceId'].get('type')
             events.append(event)
     return events
Esempio n. 5
0
 def main(self):
     req = DescribeServices.from_other(
         self,
         ListAll=True,
         ShowEvents=True,
         ShowEventStacks=self.args.get('show_stack_traces'))
     result = req.main()
     events = []
     for service in result.get('serviceStatuses') or []:
         for r_event in service.get('statusDetails') or []:
             event = Event.from_status_detail(r_event)
             event.subject_type = service['serviceId'].get('type')
             events.append(event)
     return events