Revision 439ff929
b/snf-cyclades-app/synnefo/logic/management/commands/network-inspect.py | ||
---|---|---|
58 | 58 |
sep = '-' * 80 + '\n' |
59 | 59 |
labels = ('name', 'backend-name', 'state', 'owner', 'subnet', 'gateway', |
60 | 60 |
'max_prefix', 'link', 'public', 'dhcp', 'type', 'deleted', |
61 |
'action') |
|
61 |
'action', 'pool')
|
|
62 | 62 |
fields = (net.name, net.backend_id, net.state, str(net.userid), |
63 | 63 |
str(net.subnet), str(net.gateway), str(net.mac_prefix), |
64 | 64 |
str(net.link), str(net.public), str(net.dhcp), |
65 |
str(net.type), str(net.deleted), str(net.action)) |
|
65 |
str(net.type), str(net.deleted), str(net.action), |
|
66 |
str(splitPoolMap(net.pool.get_map(), 64))) |
|
66 | 67 |
|
67 | 68 |
self.stdout.write(sep) |
68 | 69 |
self.stdout.write('State of Network in DB\n') |
... | ... | |
99 | 100 |
backend.clustername) |
100 | 101 |
else: |
101 | 102 |
raise e |
103 |
|
|
104 |
|
|
105 |
def splitPoolMap(s, count): |
|
106 |
splited = [''.join(x) for x in zip(*[list(s[z::count]) for z in |
|
107 |
range(count)])] |
|
108 |
acc = [] |
|
109 |
for i in range(0, len(splited)): |
|
110 |
acc.append(str(i * count).ljust(4) + ' ' + splited[i] + ' ' + |
|
111 |
str((i + 1) * count - 1).ljust(4)) |
|
112 |
return '\n' + '\n'.join(acc) |
Also available in: Unified diff