Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
c154af98
Commit
c154af98
authored
Dec 03, 2015
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export LXC_TARGET env variable in stop hook
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
11438797
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
lxc.container.conf.sgml.in
doc/lxc.container.conf.sgml.in
+13
-1
start.c
src/lxc/start.c
+9
-0
No files found.
doc/lxc.container.conf.sgml.in
View file @
c154af98
...
@@ -1566,7 +1566,19 @@ mknod errno 0
...
@@ -1566,7 +1566,19 @@ mknod errno 0
</listitem>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</variablelist>
<variablelist>
<varlistentry>
<term>
<option>LXC_TARGET</option>
</term>
<listitem>
<para>
Only for the stop hook. Is set to "stop" for a container
shutdown or "reboot" for a container reboot.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect2>
<refsect2>
<refsect2>
<title>Logging</title>
<title>Logging</title>
...
...
src/lxc/start.c
View file @
c154af98
...
@@ -522,8 +522,17 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
...
@@ -522,8 +522,17 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
}
}
}
}
namespaces
[
namespace_count
]
=
NULL
;
namespaces
[
namespace_count
]
=
NULL
;
if
(
handler
->
conf
->
reboot
&&
setenv
(
"LXC_TARGET"
,
"reboot"
,
1
))
{
SYSERROR
(
"failed to set environment variable for stop target"
);
}
if
(
!
handler
->
conf
->
reboot
&&
setenv
(
"LXC_TARGET"
,
"stop"
,
1
))
{
SYSERROR
(
"failed to set environment variable for stop target"
);
}
if
(
run_lxc_hooks
(
name
,
"stop"
,
handler
->
conf
,
handler
->
lxcpath
,
namespaces
))
if
(
run_lxc_hooks
(
name
,
"stop"
,
handler
->
conf
,
handler
->
lxcpath
,
namespaces
))
ERROR
(
"failed to run stop hooks for container '%s'."
,
name
);
ERROR
(
"failed to run stop hooks for container '%s'."
,
name
);
while
(
namespace_count
--
)
while
(
namespace_count
--
)
free
(
namespaces
[
namespace_count
]);
free
(
namespaces
[
namespace_count
]);
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
{
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
{
...
...
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