Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hardik Juneja
slapos.core
Commits
749c3820
Commit
749c3820
authored
May 26, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapformat: Check if we allow bridge before trying extraordinary mesures to get address
parent
73935be5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
slapos/format.py
slapos/format.py
+11
-7
No files found.
slapos/format.py
View file @
749c3820
...
@@ -179,7 +179,7 @@ class Computer(object):
...
@@ -179,7 +179,7 @@ class Computer(object):
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
reference
,
self
.
interface
)
return
(
self
.
reference
,
self
.
interface
)
def
getAddress
(
self
):
def
getAddress
(
self
,
no_bridge
=
False
):
"""
"""
Return a list of the interface address not attributed to any partition, (which
Return a list of the interface address not attributed to any partition, (which
are therefore free for the computer itself).
are therefore free for the computer itself).
...
@@ -201,12 +201,16 @@ class Computer(object):
...
@@ -201,12 +201,16 @@ class Computer(object):
if
address_dict
[
'addr'
]
not
in
computer_partition_address_list
:
if
address_dict
[
'addr'
]
not
in
computer_partition_address_list
:
return
address_dict
return
address_dict
if
not
no_bridge
:
# all addresses on interface are for partition, so lets add new one
# all addresses on interface are for partition, so lets add new one
computer_tap
=
Tap
(
'compdummy'
)
computer_tap
=
Tap
(
'compdummy'
)
computer_tap
.
createWithOwner
(
User
(
'root'
),
attach_to_tap
=
True
)
computer_tap
.
createWithOwner
(
User
(
'root'
),
attach_to_tap
=
True
)
self
.
interface
.
addTap
(
computer_tap
)
self
.
interface
.
addTap
(
computer_tap
)
return
self
.
interface
.
addAddr
()
return
self
.
interface
.
addAddr
()
# Can't find address
return
False
def
send
(
self
,
config
):
def
send
(
self
,
config
):
"""
"""
Send a marshalled dictionary of the computer object serialized via_getDict.
Send a marshalled dictionary of the computer object serialized via_getDict.
...
@@ -976,7 +980,7 @@ def run(config):
...
@@ -976,7 +980,7 @@ def run(config):
computer
.
instance_root
=
config
.
instance_root
computer
.
instance_root
=
config
.
instance_root
computer
.
software_root
=
config
.
software_root
computer
.
software_root
=
config
.
software_root
config
.
logger
.
info
(
'Updating computer'
)
config
.
logger
.
info
(
'Updating computer'
)
address
=
computer
.
getAddress
()
address
=
computer
.
getAddress
(
config
.
no_bridge
)
computer
.
address
=
address
[
'addr'
]
computer
.
address
=
address
[
'addr'
]
computer
.
netmask
=
address
[
'netmask'
]
computer
.
netmask
=
address
[
'netmask'
]
...
...
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