Revision b48697f0 snf-cyclades-app/synnefo/logic/management/commands/pool-show.py
b/snf-cyclades-app/synnefo/logic/management/commands/pool-show.py | ||
---|---|---|
35 | 35 |
from optparse import make_option |
36 | 36 |
|
37 | 37 |
from synnefo.db.pools import bitarray_to_map |
38 |
from synnefo.db.models import MacPrefixPoolTable, BridgePoolTable |
|
39 |
from synnefo.management import pprint |
|
38 |
from synnefo.management import pprint, common |
|
40 | 39 |
|
41 | 40 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
42 | 41 |
|
... | ... | |
58 | 57 |
if not type_: |
59 | 58 |
raise CommandError("Type of pool is mandatory") |
60 | 59 |
|
61 |
pool_table = pool_table_from_type(type_) |
|
60 |
pool_table = common.pool_table_from_type(type_)
|
|
62 | 61 |
|
63 | 62 |
try: |
64 | 63 |
pool_id = int(args[0]) |
... | ... | |
86 | 85 |
pprint.pprint_pool('Reserved', |
87 | 86 |
bitarray_to_map(pool.reserved[:pool_row.size]), |
88 | 87 |
step, self.stdout) |
89 |
|
|
90 |
|
|
91 |
def pool_table_from_type(type_): |
|
92 |
if type_ == "mac-prefix": |
|
93 |
return MacPrefixPoolTable |
|
94 |
elif type_ == "bridge": |
|
95 |
return BridgePoolTable |
|
96 |
# elif type == "ip": |
|
97 |
# return IPPoolTable |
|
98 |
else: |
|
99 |
raise ValueError("Invalid pool type") |
Also available in: Unified diff