def nova_collector(self, destination, resources):
        collected_items = {}
        self.chose_destination_cloud(destination)
        if 'servers' in resources:
            vm_list = []
            servers_list = self.cloud_info.novaclient.servers.list(
                search_opts={'all_tenants': 1})
            for server in servers_list:
                vm = server.__dict__['_info']
                vm.pop('updated', None)
                vm_list.append(vm)
            collected_items['servers'] = vm_list
        if 'flavors' in resources:
            flavors = self.cloud_info.novaclient.flavors.list(is_public=None)
            collected_items['flavors'] = [f.__dict__['_info'] for f in flavors]
        if 'quotas' in resources:
            quotas = {}
            for tenant in self.cloud_info.keystoneclient.tenants.list():
                quota_list = self.cloud_info.novaclient.quotas.get(
                    tenant.id)
                quotas[tenant.name] = quota_list.__dict__['_info']
            collected_items['quotas'] = quotas

        if 'security_groups' in resources:
            sgs = self.cloud_info.novaclient.security_groups.list()
            collected_items['security_groups'] = [sg.__dict__['_info']
                                                  for sg in sgs]
        if 'keypairs' in resources:
            def get_user(name):
                for _user in users:
                    if _user['name'] == name:
                        return _user
            keypairs = []
            users = self.config.users
            users.append({'name': self.cloud_info.username,
                          'password': self.cloud_info.password,
                          'tenant': self.cloud_info.tenant})
            user_names = [u['name'] for u in self.config.users]
            existing_tenants = [t.id for t in
                                self.cloud_info.keystoneclient.tenants.list()]
            for user in self.cloud_info.keystoneclient.users.list():
                if user.name not in user_names or\
                        not getattr(user, 'tenantId', None) or\
                        not user.enabled or\
                        user.tenantId not in existing_tenants:
                    continue
                creds = get_user(user.name)
                self.cloud_info.switch_user(user=creds['name'],
                                            password=creds['password'],
                                            tenant=creds['tenant'])
                kps = self.cloud_info.novaclient.keypairs.list()
                if kps:
                    kps = [kp.__dict__['_info'] for kp in kps]
                keypairs.append({user.name: kps})
            collected_items['keypairs'] = keypairs
            self.cloud_info.switch_user(user=self.cloud_info.username,
                                        password=self.cloud_info.password,
                                        tenant=self.cloud_info.tenant)
        return collected_items
Nova data collector method.
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry_devlab/cloudferry_devlab/tests/data_collector.py/DataCollector.nova_collector