Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-ganeti
Commits
f6c5e64f
Commit
f6c5e64f
authored
12 years ago
by
Dimitris Aragiorgis
Browse files
Options
Downloads
Patches
Plain Diff
Use base64 format in network reservations slots
Signed-off-by:
Dimitris Aragiorgis
<
dimara@grnet.gr
>
parent
c54ec0dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/network.py
+8
-4
8 additions, 4 deletions
lib/network.py
with
8 additions
and
4 deletions
lib/network.py
+
8
−
4
View file @
f6c5e64f
...
...
@@ -26,6 +26,8 @@
import
ipaddr
from
bitarray
import
bitarray
from
base64
import
b64encode
from
base64
import
b64decode
from
ganeti
import
errors
...
...
@@ -60,13 +62,15 @@ class AddressPool(object):
self
.
gateway6
=
ipaddr
.
IPv6Address
(
self
.
net
.
gateway6
)
if
self
.
net
.
reservations
:
self
.
reservations
=
bitarray
(
self
.
net
.
reservations
)
self
.
reservations
=
bitarray
()
self
.
reservations
.
fromstring
(
b64decode
(
self
.
net
.
reservations
))
else
:
self
.
reservations
=
bitarray
(
self
.
network
.
numhosts
)
self
.
reservations
.
setall
(
False
)
if
self
.
net
.
ext_reservations
:
self
.
ext_reservations
=
bitarray
(
self
.
net
.
ext_reservations
)
self
.
ext_reservations
=
bitarray
()
self
.
ext_reservations
.
fromstring
(
b64decode
(
self
.
net
.
ext_reservations
))
else
:
self
.
ext_reservations
=
bitarray
(
self
.
network
.
numhosts
)
self
.
ext_reservations
.
setall
(
False
)
...
...
@@ -92,8 +96,8 @@ class AddressPool(object):
def
_Update
(
self
):
"""
Write address pools back to the network object
"""
self
.
net
.
ext_reservations
=
self
.
ext_reservations
.
to
01
()
self
.
net
.
reservations
=
self
.
reservations
.
to
01
()
self
.
net
.
ext_reservations
=
b64encode
(
self
.
ext_reservations
.
to
string
()
)
self
.
net
.
reservations
=
b64encode
(
self
.
reservations
.
to
string
()
)
def
_Mark
(
self
,
address
,
value
=
True
,
external
=
False
):
idx
=
self
.
_GetAddrIndex
(
address
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment