Revision beb81ea5 lib/client/gnt_network.py
b/lib/client/gnt_network.py | ||
---|---|---|
20 | 20 |
|
21 | 21 |
"""IP pool related commands""" |
22 | 22 |
|
23 |
# pylint: disable-msg=W0401,W0614
|
|
23 |
# pylint: disable=W0401,W0614 |
|
24 | 24 |
# W0401: Wildcard import ganeti.cli |
25 | 25 |
# W0614: Unused import %s from wildcard import (since we need cli) |
26 | 26 |
|
... | ... | |
68 | 68 |
network6=opts.network6, |
69 | 69 |
mac_prefix=opts.mac_prefix, |
70 | 70 |
network_type=opts.network_type, |
71 |
add_reserved_ips=_HandleReservedIPs(opts.add_reserved_ips), |
|
71 |
add_reserved_ips=\ |
|
72 |
_HandleReservedIPs(opts.add_reserved_ips), |
|
72 | 73 |
tags=tags) |
73 | 74 |
SubmitOpCode(op, opts=opts) |
74 | 75 |
|
... | ... | |
167 | 168 |
not opts.no_headers) |
168 | 169 |
|
169 | 170 |
|
170 |
def ShowNetworkConfig(opts, args):
|
|
171 |
def ShowNetworkConfig(_, args):
|
|
171 | 172 |
"""Show network information. |
172 | 173 |
|
173 | 174 |
@param opts: the command line options selected by the user |
... | ... | |
190 | 191 |
|
191 | 192 |
for (name, network, gateway, network6, gateway6, |
192 | 193 |
mac_prefix, network_type, free_count, reserved_count, |
193 |
map, group_list, instances, ext_res) in result: |
|
194 |
mapping, group_list, instances, ext_res) in result:
|
|
194 | 195 |
size = free_count + reserved_count |
195 | 196 |
ToStdout("Network name: %s", name) |
196 | 197 |
ToStdout(" subnet: %s", network) |
... | ... | |
204 | 205 |
100 * float(free_count)/float(size)) |
205 | 206 |
ToStdout(" usage map:") |
206 | 207 |
idx = 0 |
207 |
for line in wrap(map, width=64): |
|
208 |
for line in wrap(mapping, width=64):
|
|
208 | 209 |
ToStdout(" %s %s %d", str(idx).rjust(3), line.ljust(64), idx + 63) |
209 | 210 |
idx += 64 |
210 | 211 |
ToStdout(" (X) used (.) free") |
... | ... | |
228 | 229 |
["nic.ips", "nic.networks"], |
229 | 230 |
use_locking=False) |
230 | 231 |
|
231 |
l = lambda value: ", ".join(`idx`+":"+str(ip)
|
|
232 |
l = lambda value: ", ".join(str(idx)+":"+str(ip)
|
|
232 | 233 |
for idx, (ip, net) in enumerate(value) |
233 | 234 |
if net == name) |
234 | 235 |
|
235 |
ToStdout(" %s : %s", inst, l(zip(ips,networks))) |
|
236 |
ToStdout(" %s : %s", inst, l(zip(ips, networks)))
|
|
236 | 237 |
else: |
237 | 238 |
ToStdout(" not used by any instances") |
238 | 239 |
|
... | ... | |
264 | 265 |
ToStderr("Please give at least one of the parameters.") |
265 | 266 |
return 1 |
266 | 267 |
|
267 |
op = opcodes.OpNetworkSetParams(network_name=args[0], |
|
268 |
# pylint: disable-msg=W0142 |
|
269 |
**all_changes) |
|
268 |
# pylint: disable=W0142 |
|
269 |
op = opcodes.OpNetworkSetParams(network_name=args[0], **all_changes) |
|
270 | 270 |
|
271 | 271 |
# TODO: add feedback to user, e.g. list the modifications |
272 | 272 |
SubmitOrSend(op, opts) |
Also available in: Unified diff