Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
b124b12d
Commit
b124b12d
authored
Jul 20, 2012
by
Christos Stavrakakis
Browse files
Display IP pool map in network-inspect command
parent
fe68a4c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/logic/management/commands/network-inspect.py
View file @
b124b12d
...
...
@@ -58,11 +58,12 @@ class Command(BaseCommand):
sep
=
'-'
*
80
+
'
\n
'
labels
=
(
'name'
,
'backend-name'
,
'state'
,
'owner'
,
'subnet'
,
'gateway'
,
'max_prefix'
,
'link'
,
'public'
,
'dhcp'
,
'type'
,
'deleted'
,
'action'
)
'action'
,
'pool'
)
fields
=
(
net
.
name
,
net
.
backend_id
,
net
.
state
,
str
(
net
.
userid
),
str
(
net
.
subnet
),
str
(
net
.
gateway
),
str
(
net
.
mac_prefix
),
str
(
net
.
link
),
str
(
net
.
public
),
str
(
net
.
dhcp
),
str
(
net
.
type
),
str
(
net
.
deleted
),
str
(
net
.
action
))
str
(
net
.
type
),
str
(
net
.
deleted
),
str
(
net
.
action
),
str
(
splitPoolMap
(
net
.
pool
.
get_map
(),
64
)))
self
.
stdout
.
write
(
sep
)
self
.
stdout
.
write
(
'State of Network in DB
\n
'
)
...
...
@@ -99,3 +100,13 @@ class Command(BaseCommand):
backend
.
clustername
)
else
:
raise
e
def
splitPoolMap
(
s
,
count
):
splited
=
[
''
.
join
(
x
)
for
x
in
zip
(
*
[
list
(
s
[
z
::
count
])
for
z
in
range
(
count
)])]
acc
=
[]
for
i
in
range
(
0
,
len
(
splited
)):
acc
.
append
(
str
(
i
*
count
).
ljust
(
4
)
+
' '
+
splited
[
i
]
+
' '
+
str
((
i
+
1
)
*
count
-
1
).
ljust
(
4
))
return
'
\n
'
+
'
\n
'
.
join
(
acc
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment