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
Eric Zheng
slapos.toolbox
Commits
5611378d
Commit
5611378d
authored
Aug 29, 2012
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add promise support on slapcontainer script
parent
a8b082be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
slapos/container/process.py
slapos/container/process.py
+15
-2
No files found.
slapos/container/process.py
View file @
5611378d
...
...
@@ -38,6 +38,10 @@ def main(sr_directory, partition_list, database, bridge_name):
# XXX: Hardcoded path
lxc_conf_path
=
os
.
path
.
join
(
partition_path
,
'etc/lxc.conf'
)
lxc_state_path
=
os
.
path
.
join
(
partition_path
,
'.slapcontainer.state'
)
sib_state_path
=
os
.
path
.
join
(
partition_path
,
'.shellinabox.state'
)
# XXX: Avoid hacking slapos.core
##########################################################
magic_string
=
'!!BRIDGE_NAME!!'
...
...
@@ -61,7 +65,9 @@ def main(sr_directory, partition_list, database, bridge_name):
name
=
name
,
database
=
database
,
logger
=
partition_logger
,
lxc_conf_filename
=
lxc_conf_path
)
lxc_conf_filename
=
lxc_conf_path
,
lxc_state_path
=
lxc_state_path
,
sib_state_path
=
sib_state_path
)
if
start_requested
:
logger
.
debug
(
'Container which start was requested : %s.'
,
...
...
@@ -126,7 +132,9 @@ def process_partition(requested_status,
name
,
database
,
logger
,
lxc_conf_filename
):
lxc_conf_filename
,
lxc_state_path
,
sib_state_path
):
if
requested_status
==
'started'
:
...
...
@@ -143,6 +151,9 @@ def process_partition(requested_status,
else
:
current_status
=
'stopped'
with
open
(
lxc_state_path
,
'w'
)
as
lxc_state_file
:
lxc_state_file
.
write
(
current_status
)
### If container is not launch, launch it
if
requested_status
!=
current_status
:
logger
.
debug
(
'Start lxc.'
)
...
...
@@ -162,6 +173,8 @@ def process_partition(requested_status,
pid
=
int
(
database
[
name
])
if
is_pid_running
(
pid
):
current_status
=
'started'
with
open
(
sib_state_path
,
'w'
)
as
sib_state_file
:
sib_state_file
.
write
(
current_status
)
if
current_status
==
'stopped'
:
logger
.
debug
(
'Start shellinabox.'
)
...
...
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