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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hardik Juneja
slapos.toolbox
Commits
a8b082be
Commit
a8b082be
authored
Aug 22, 2012
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the bridge name in lxc.conf
parent
0c85687b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
slapos/container/__init__.py
slapos/container/__init__.py
+2
-1
slapos/container/process.py
slapos/container/process.py
+12
-1
No files found.
slapos/container/__init__.py
View file @
a8b082be
...
@@ -50,6 +50,7 @@ def run(args):
...
@@ -50,6 +50,7 @@ def run(args):
partition_amount
=
slapos_conf
.
getint
(
'slapformat'
,
'partition_amount'
)
partition_amount
=
slapos_conf
.
getint
(
'slapformat'
,
'partition_amount'
)
partition_base_name
=
slapos_conf
.
get
(
'slapformat'
,
'partition_base_name'
)
partition_base_name
=
slapos_conf
.
get
(
'slapformat'
,
'partition_base_name'
)
bridge_name
=
slapos_conf
.
get
(
'slapformat'
,
'interface_name'
)
instance_root
=
slapos_conf
.
get
(
'slapos'
,
'instance_root'
)
instance_root
=
slapos_conf
.
get
(
'slapos'
,
'instance_root'
)
partition_base_path
=
os
.
path
.
join
(
instance_root
,
partition_base_name
)
partition_base_path
=
os
.
path
.
join
(
instance_root
,
partition_base_name
)
partition_list
=
[
'%s%d'
%
(
partition_base_path
,
i
)
partition_list
=
[
'%s%d'
%
(
partition_base_path
,
i
)
...
@@ -59,7 +60,7 @@ def run(args):
...
@@ -59,7 +60,7 @@ def run(args):
database
=
gdbm
.
open
(
args
.
database
,
'c'
,
0600
)
database
=
gdbm
.
open
(
args
.
database
,
'c'
,
0600
)
try
:
try
:
process
.
main
(
sr_directory
,
partition_list
,
database
)
process
.
main
(
sr_directory
,
partition_list
,
database
,
bridge_name
)
finally
:
finally
:
database
.
sync
()
database
.
sync
()
database
.
close
()
database
.
close
()
slapos/container/process.py
View file @
a8b082be
...
@@ -12,7 +12,7 @@ class SlapContainerError(Exception):
...
@@ -12,7 +12,7 @@ class SlapContainerError(Exception):
def
main
(
sr_directory
,
partition_list
,
database
):
def
main
(
sr_directory
,
partition_list
,
database
,
bridge_name
):
logger
=
logging
.
getLogger
(
'process'
)
logger
=
logging
.
getLogger
(
'process'
)
...
@@ -38,6 +38,17 @@ def main(sr_directory, partition_list, database):
...
@@ -38,6 +38,17 @@ def main(sr_directory, partition_list, database):
# XXX: Hardcoded path
# XXX: Hardcoded path
lxc_conf_path
=
os
.
path
.
join
(
partition_path
,
lxc_conf_path
=
os
.
path
.
join
(
partition_path
,
'etc/lxc.conf'
)
'etc/lxc.conf'
)
# XXX: Avoid hacking slapos.core
##########################################################
magic_string
=
'!!BRIDGE_NAME!!'
with
open
(
lxc_conf_path
,
'r'
)
as
lxc_conf_file
:
lxc_conf_content
=
lxc_conf_file
.
read
()
if
magic_string
in
lxc_conf_content
:
with
open
(
lxc_conf_path
,
'w'
)
as
lxc_conf_file
:
lxc_conf_file
.
write
(
lxc_conf_content
.
replace
(
magic_string
,
bridge_name
)
)
##########################################################
with
open
(
lxc_conf_path
,
'r'
)
as
lxc_conf_file
:
with
open
(
lxc_conf_path
,
'r'
)
as
lxc_conf_file
:
requested_status
=
lxc_conf_file
.
readline
().
strip
(
'
\
n
\
r
\
t
#'
)
requested_status
=
lxc_conf_file
.
readline
().
strip
(
'
\
n
\
r
\
t
#'
)
...
...
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