Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos.toolbox
Commits
7076f75c
Commit
7076f75c
authored
Jul 26, 2012
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to veth with slapos' bridge for lxc networking
parent
63166871
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
slapos/container/__init__.py
slapos/container/__init__.py
+2
-1
slapos/container/prepare.py
slapos/container/prepare.py
+6
-8
No files found.
slapos/container/__init__.py
View file @
7076f75c
...
...
@@ -21,5 +21,6 @@ def main():
partition_base_path
=
os
.
path
.
join
(
instance_root
,
partition_base_name
)
partition_list
=
[
'%s%d'
%
(
partition_base_path
,
i
)
for
i
in
range
(
partition_amount
)]
bridge_name
=
slapos_conf
.
get
(
'slapformat'
,
'interface_name'
)
prepare
.
main
(
sr_directory
,
partition_list
)
prepare
.
main
(
sr_directory
,
partition_list
,
bridge_name
)
slapos/container/prepare.py
View file @
7076f75c
...
...
@@ -16,7 +16,7 @@ class SlapContainerError(Exception):
def
main
(
sr_directory
,
partition_list
):
def
main
(
sr_directory
,
partition_list
,
bridge_name
):
for
partition_path
in
partition_list
:
slapcontainer_filename
=
os
.
path
.
join
(
partition_path
,
...
...
@@ -34,7 +34,7 @@ def main(sr_directory, partition_list):
if
requested_status
==
'started'
:
if
not
created
(
partition_path
,
slapcontainer_conf
):
create
(
sr_directory
,
partition_path
,
slapcontainer_conf
)
slapcontainer_conf
,
bridge_name
)
if
status
(
sr_directory
,
partition_path
)
==
'stopped'
:
start
(
sr_directory
,
partition_path
)
else
:
...
...
@@ -96,7 +96,7 @@ def extract_rootfs(partition_path, conf):
def
create
(
sr_directory
,
partition_path
,
conf
):
def
create
(
sr_directory
,
partition_path
,
conf
,
bridge_name
):
tmp_dir
=
conf
.
get
(
'rootfs'
,
'tmp'
)
rootfs_dir
=
conf
.
get
(
'rootfs'
,
'directory'
)
if
os
.
path
.
exists
(
tmp_dir
):
...
...
@@ -108,12 +108,10 @@ def create(sr_directory, partition_path, conf):
lxc_filename
=
os
.
path
.
join
(
partition_path
,
'config'
)
lxc
=
LXCConfig
()
lxc
.
utsname
=
os
.
path
.
basename
(
partition_path
)
lxc
.
network
.
type
=
'vlan'
lxc
.
network
.
link
=
conf
.
get
(
'network'
,
'interface'
)
lxc
.
network
.
type
=
'veth'
lxc
.
network
.
link
=
bridge_name
lxc
.
network
.
veth
.
pair
=
'lxc%s'
%
conf
.
get
(
'network'
,
'interface'
)
lxc
.
network
.
name
=
'eth0'
# XXX: Hardcoded netmasks
lxc
.
network
.
ipv4
=
'%s/32'
%
conf
.
get
(
'network'
,
'ipv4'
)
lxc
.
network
.
ipv6
=
'%s/128'
%
conf
.
get
(
'network'
,
'ipv6'
)
lxc
.
network
.
flags
=
'up'
# XXX: Hardcoded stuff
lxc
.
tty
=
'4'
...
...
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