Revision 9c15e488
b/snf-cyclades-app/synnefo/api/management/commands/port-inspect.py | ||
---|---|---|
67 | 67 |
|
68 | 68 |
port = get_port(args[0], None) |
69 | 69 |
|
70 |
sep = '-' * 80 + '\n' |
|
71 |
|
|
72 | 70 |
db_nic = { |
73 | 71 |
"id": port.id, |
74 | 72 |
"name": port.name, |
... | ... | |
79 | 77 |
"mac": port.mac, |
80 | 78 |
"state": port.state} |
81 | 79 |
|
82 |
self.stdout.write(sep) |
|
83 |
self.stdout.write('State of port in DB\n') |
|
84 |
self.stdout.write(sep) |
|
85 |
pprint_table(self.stdout, db_nic.items(), None, separator=" | ") |
|
86 |
|
|
80 |
pprint_table(self.stdout, db_nic.items(), None, separator=" | ", |
|
81 |
title="State of port in DB") |
|
87 | 82 |
self.stdout.write('\n\n') |
83 |
|
|
88 | 84 |
ips = list(port.ips.values_list("address", "network_id", "subnet_id", |
89 | 85 |
"subnet__cidr", "floating_ip")) |
90 | 86 |
headers = ["Address", "Network", "Subnet", "CIDR", "is_floating"] |
91 |
pprint_table(self.stdout, ips, headers, separator=" | ")
|
|
92 |
|
|
87 |
pprint_table(self.stdout, ips, headers, separator=" | ",
|
|
88 |
title="IP Addresses") |
|
93 | 89 |
self.stdout.write('\n\n') |
94 | 90 |
|
95 |
self.stdout.write(sep) |
|
96 |
self.stdout.write('State of port in Ganeti\n') |
|
97 |
self.stdout.write(sep) |
|
98 | 91 |
vm = port.machine |
99 | 92 |
if vm is None: |
100 | 93 |
self.stdout.write("Port is not attached to any instance.\n") |
... | ... | |
119 | 112 |
self.stdout.write("NIC %s is not attached to instance %s" |
120 | 113 |
% (port, vm)) |
121 | 114 |
return |
122 |
pprint_table(self.stdout, gnt_nic.items(), None, separator=" | ") |
|
115 |
pprint_table(self.stdout, gnt_nic.items(), None, separator=" | ", |
|
116 |
title="State of port in Ganeti") |
|
123 | 117 |
|
124 | 118 |
vm.put_client(client) |
Also available in: Unified diff