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
2f7828f6
Unverified
Commit
2f7828f6
authored
Jun 08, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/lxc_autostart: fix failed count
Don't include skipped containers in the failed count. Fixes: #3857 Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
81ec0d7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
lxc_autostart.c
src/lxc/tools/lxc_autostart.c
+16
-10
No files found.
src/lxc/tools/lxc_autostart.c
View file @
2f7828f6
...
@@ -347,6 +347,7 @@ int main(int argc, char *argv[])
...
@@ -347,6 +347,7 @@ int main(int argc, char *argv[])
if
(
!
cmd_groups_list
)
if
(
!
cmd_groups_list
)
cmd_groups_list
=
accumulate_list
(
""
,
","
,
NULL
);
cmd_groups_list
=
accumulate_list
(
""
,
","
,
NULL
);
failed
=
0
;
lxc_list_for_each
(
cmd_group
,
cmd_groups_list
)
{
lxc_list_for_each
(
cmd_group
,
cmd_groups_list
)
{
/* Because we may take several passes through the container list
/* Because we may take several passes through the container list
* We'll switch on if the container pointer is NULL and if we
* We'll switch on if the container pointer is NULL and if we
...
@@ -411,8 +412,10 @@ int main(int argc, char *argv[])
...
@@ -411,8 +412,10 @@ int main(int argc, char *argv[])
}
}
else
{
else
{
if
(
!
c
->
shutdown
(
c
,
my_args
.
timeout
))
{
if
(
!
c
->
shutdown
(
c
,
my_args
.
timeout
))
{
if
(
!
c
->
stop
(
c
))
if
(
!
c
->
stop
(
c
))
{
failed
++
;
ERROR
(
"Error shutting down container: %s"
,
c
->
name
);
ERROR
(
"Error shutting down container: %s"
,
c
->
name
);
}
}
}
}
}
}
}
...
@@ -424,8 +427,10 @@ int main(int argc, char *argv[])
...
@@ -424,8 +427,10 @@ int main(int argc, char *argv[])
fflush
(
stdout
);
fflush
(
stdout
);
}
}
else
{
else
{
if
(
!
c
->
stop
(
c
))
if
(
!
c
->
stop
(
c
))
{
failed
++
;
ERROR
(
"Error killing container: %s"
,
c
->
name
);
ERROR
(
"Error killing container: %s"
,
c
->
name
);
}
}
}
}
}
}
else
if
(
my_args
.
reboot
)
{
}
else
if
(
my_args
.
reboot
)
{
...
@@ -437,10 +442,12 @@ int main(int argc, char *argv[])
...
@@ -437,10 +442,12 @@ int main(int argc, char *argv[])
fflush
(
stdout
);
fflush
(
stdout
);
}
}
else
{
else
{
if
(
!
c
->
reboot
(
c
))
if
(
!
c
->
reboot
(
c
))
{
failed
++
;
ERROR
(
"Error rebooting container: %s"
,
c
->
name
);
ERROR
(
"Error rebooting container: %s"
,
c
->
name
);
else
}
else
{
sleep
(
get_config_integer
(
c
,
"lxc.start.delay"
));
sleep
(
get_config_integer
(
c
,
"lxc.start.delay"
));
}
}
}
}
}
}
else
{
}
else
{
...
@@ -452,10 +459,12 @@ int main(int argc, char *argv[])
...
@@ -452,10 +459,12 @@ int main(int argc, char *argv[])
fflush
(
stdout
);
fflush
(
stdout
);
}
}
else
{
else
{
if
(
!
c
->
start
(
c
,
0
,
NULL
))
if
(
!
c
->
start
(
c
,
0
,
NULL
))
{
failed
++
;
ERROR
(
"Error starting container: %s"
,
c
->
name
);
ERROR
(
"Error starting container: %s"
,
c
->
name
);
else
}
else
{
sleep
(
get_config_integer
(
c
,
"lxc.start.delay"
));
sleep
(
get_config_integer
(
c
,
"lxc.start.delay"
));
}
}
}
}
}
}
}
...
@@ -479,12 +488,9 @@ int main(int argc, char *argv[])
...
@@ -479,12 +488,9 @@ int main(int argc, char *argv[])
/* clean up any lingering detritus, if container exists here
/* clean up any lingering detritus, if container exists here
* then it must have failed to start.
* then it must have failed to start.
*/
*/
failed
=
0
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
containers
[
i
])
{
if
(
containers
[
i
])
failed
++
;
lxc_container_put
(
containers
[
i
]);
lxc_container_put
(
containers
[
i
]);
}
if
(
c_groups_lists
&&
c_groups_lists
[
i
])
if
(
c_groups_lists
&&
c_groups_lists
[
i
])
toss_list
(
c_groups_lists
[
i
]);
toss_list
(
c_groups_lists
[
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