Revision d443e1dd

b/snf-cyclades-app/synnefo/api/management/commands/network-list.py
128 128
        else:
129 129
            headers.extend(['IPv4 Subnet', 'IPv4 Gateway'])
130 130

  
131
        uuids = list(set([network.userid for network in networks]))
132
        ucache.fetch_names(uuids)
131
        if displayname:
132
            uuids = list(set([network.userid for network in networks]))
133
            ucache.fetch_names(uuids)
133 134

  
134 135
        table = []
135 136
        for network in networks.order_by("id"):
b/snf-cyclades-app/synnefo/api/management/commands/server-list.py
136 136
                          'backend',
137 137
                          ])
138 138

  
139
        uuids = list(set([server.userid for server in servers]))
140
        ucache.fetch_names(uuids)
139
        if displayname:
140
            uuids = list(set([server.userid for server in servers]))
141
            ucache.fetch_names(uuids)
141 142

  
142 143
        table = []
143 144
        for server in servers.order_by('id'):
b/snf-cyclades-app/synnefo/management/common.py
263 263
        assert(self.split > 0), "split must be positive"
264 264

  
265 265
    def fetch_names(self, uuid_list):
266
        l = len(uuid_list)
266
        total = len(uuid_list)
267
        split = self.split
267 268

  
268
        start = 0
269
        while start < l:
270
            end = self.split if l > self.split else l
269
        for start in range(0, total, split):
270
            end = start + split
271 271
            try:
272 272
                names = \
273 273
                    astakos.get_displaynames(token=ASTAKOS_TOKEN,
......
277 277
            except Exception as e:
278 278
                log.error("Failed to fetch names: %s",  e)
279 279

  
280
            start = end
281

  
282 280
    def get_uuid(self, name):
283 281
        if not name in self.users:
284 282
            try:

Also available in: Unified diff