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
e85e742c
Commit
e85e742c
authored
Apr 23, 2017
by
Stéphane Graber
Committed by
GitHub
Apr 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1523 from brauner/2017-04-23/improve_cgfsng_debug
cgroups: improve cgfsng debugging
parents
2e2cbfd2
0bc4a847
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
21 deletions
+43
-21
ISSUE_TEMPLATE.md
.github/ISSUE_TEMPLATE.md
+1
-1
cgfsng.c
src/lxc/cgroups/cgfsng.c
+42
-20
No files found.
.github/ISSUE_TEMPLATE.md
View file @
e85e742c
...
@@ -9,7 +9,7 @@ Feel free to remove anything which doesn't apply to you and add more information
...
@@ -9,7 +9,7 @@ Feel free to remove anything which doesn't apply to you and add more information
*
`lxc-start --version`
*
`lxc-start --version`
*
`lxc-checkconfig`
*
`lxc-checkconfig`
*
`uname -a`
*
`uname -a`
*
`cat /proc/self/cgroup
s
`
*
`cat /proc/self/cgroup`
*
`cat /proc/1/mounts`
*
`cat /proc/1/mounts`
# Issue description
# Issue description
...
...
src/lxc/cgroups/cgfsng.c
View file @
e85e742c
...
@@ -101,6 +101,12 @@ struct hierarchy **hierarchies;
...
@@ -101,6 +101,12 @@ struct hierarchy **hierarchies;
*/
*/
char
*
cgroup_use
;
char
*
cgroup_use
;
/*
* @lxc_cgfsng_debug - whether to print debug info to stdout for the cgfsng
* driver
*/
static
bool
lxc_cgfsng_debug
;
static
void
free_string_list
(
char
**
clist
)
static
void
free_string_list
(
char
**
clist
)
{
{
if
(
clist
)
{
if
(
clist
)
{
...
@@ -990,41 +996,40 @@ static void trim(char *s)
...
@@ -990,41 +996,40 @@ static void trim(char *s)
s
[
--
len
]
=
'\0'
;
s
[
--
len
]
=
'\0'
;
}
}
static
void
print_init_debuginfo
(
struct
cgfsng_handler_data
*
d
)
static
void
lxc_cgfsng_print_handler_data
(
const
struct
cgfsng_handler_data
*
d
)
{
printf
(
"Cgroup information:
\n
"
);
printf
(
" container name: %s
\n
"
,
d
->
name
?
d
->
name
:
"(null)"
);
printf
(
" lxc.cgroup.use: %s
\n
"
,
cgroup_use
?
cgroup_use
:
"(null)"
);
printf
(
" lxc.cgroup.pattern: %s
\n
"
,
d
->
cgroup_pattern
?
d
->
cgroup_pattern
:
"(null)"
);
printf
(
" cgroup: %s
\n
"
,
d
->
container_cgroup
?
d
->
container_cgroup
:
"(null)"
);
}
static
void
lxc_cgfsng_print_hierarchies
()
{
{
struct
hierarchy
**
it
;
struct
hierarchy
**
it
;
int
i
;
int
i
;
if
(
!
getenv
(
"LXC_DEBUG_CGFSNG"
))
return
;
DEBUG
(
"Cgroup information:"
);
DEBUG
(
" container name: %s"
,
d
->
name
?
d
->
name
:
"(null)"
);
DEBUG
(
" lxc.cgroup.use: %s"
,
cgroup_use
?
cgroup_use
:
"(null)"
);
DEBUG
(
" lxc.cgroup.pattern: %s"
,
d
->
cgroup_pattern
?
d
->
cgroup_pattern
:
"(null)"
);
DEBUG
(
" cgroup: %s"
,
d
->
container_cgroup
?
d
->
container_cgroup
:
"(null)"
);
if
(
!
hierarchies
)
{
if
(
!
hierarchies
)
{
DEBUG
(
" No hierarchies found."
);
printf
(
" No hierarchies found."
);
return
;
return
;
}
}
DEBUG
(
" Hierarchies:
"
);
printf
(
" Hierarchies:
\n
"
);
for
(
i
=
0
,
it
=
hierarchies
;
it
&&
*
it
;
it
++
,
i
++
)
{
for
(
i
=
0
,
it
=
hierarchies
;
it
&&
*
it
;
it
++
,
i
++
)
{
char
**
cit
;
char
**
cit
;
int
j
;
int
j
;
DEBUG
(
" %d: base_cgroup %s
"
,
i
,
(
*
it
)
->
base_cgroup
?
(
*
it
)
->
base_cgroup
:
"(null)"
);
printf
(
" %d: base_cgroup %s
\n
"
,
i
,
(
*
it
)
->
base_cgroup
?
(
*
it
)
->
base_cgroup
:
"(null)"
);
DEBUG
(
" mountpoint %s
"
,
(
*
it
)
->
mountpoint
?
(
*
it
)
->
mountpoint
:
"(null)"
);
printf
(
" mountpoint %s
\n
"
,
(
*
it
)
->
mountpoint
?
(
*
it
)
->
mountpoint
:
"(null)"
);
DEBUG
(
" controllers:
"
);
printf
(
" controllers:
\n
"
);
for
(
j
=
0
,
cit
=
(
*
it
)
->
controllers
;
cit
&&
*
cit
;
cit
++
,
j
++
)
for
(
j
=
0
,
cit
=
(
*
it
)
->
controllers
;
cit
&&
*
cit
;
cit
++
,
j
++
)
DEBUG
(
" %d: %s
"
,
j
,
*
cit
);
printf
(
" %d: %s
\n
"
,
j
,
*
cit
);
}
}
}
}
static
void
print_basecg_debuginfo
(
char
*
basecginfo
,
char
**
klist
,
char
**
nlist
)
static
void
lxc_cgfsng_
print_basecg_debuginfo
(
char
*
basecginfo
,
char
**
klist
,
char
**
nlist
)
{
{
int
k
;
int
k
;
char
**
it
;
char
**
it
;
if
(
!
getenv
(
"LXC_DEBUG_CGFSNG"
))
return
;
printf
(
"basecginfo is:
\n
"
);
printf
(
"basecginfo is:
\n
"
);
printf
(
"%s
\n
"
,
basecginfo
);
printf
(
"%s
\n
"
,
basecginfo
);
...
@@ -1035,6 +1040,12 @@ static void print_basecg_debuginfo(char *basecginfo, char **klist, char **nlist)
...
@@ -1035,6 +1040,12 @@ static void print_basecg_debuginfo(char *basecginfo, char **klist, char **nlist)
printf
(
"named subsystem %d: %s
\n
"
,
k
,
*
it
);
printf
(
"named subsystem %d: %s
\n
"
,
k
,
*
it
);
}
}
static
void
lxc_cgfsng_print_debuginfo
(
const
struct
cgfsng_handler_data
*
d
)
{
lxc_cgfsng_print_handler_data
(
d
);
lxc_cgfsng_print_hierarchies
();
}
/*
/*
* At startup, parse_hierarchies finds all the info we need about
* At startup, parse_hierarchies finds all the info we need about
* cgroup mountpoints and current cgroups, and stores it in @d.
* cgroup mountpoints and current cgroups, and stores it in @d.
...
@@ -1064,7 +1075,8 @@ static bool parse_hierarchies(void)
...
@@ -1064,7 +1075,8 @@ static bool parse_hierarchies(void)
get_existing_subsystems
(
&
klist
,
&
nlist
);
get_existing_subsystems
(
&
klist
,
&
nlist
);
print_basecg_debuginfo
(
basecginfo
,
klist
,
nlist
);
if
(
lxc_cgfsng_debug
)
lxc_cgfsng_print_basecg_debuginfo
(
basecginfo
,
klist
,
nlist
);
/* we support simple cgroup mounts and lxcfs mounts */
/* we support simple cgroup mounts and lxcfs mounts */
while
(
getline
(
&
line
,
&
len
,
f
)
!=
-
1
)
{
while
(
getline
(
&
line
,
&
len
,
f
)
!=
-
1
)
{
...
@@ -1116,6 +1128,11 @@ static bool parse_hierarchies(void)
...
@@ -1116,6 +1128,11 @@ static bool parse_hierarchies(void)
fclose
(
f
);
fclose
(
f
);
free
(
line
);
free
(
line
);
if
(
lxc_cgfsng_debug
)
{
printf
(
"writeable subsystems:
\n
"
);
lxc_cgfsng_print_hierarchies
();
}
/* verify that all controllers in cgroup.use and all crucial
/* verify that all controllers in cgroup.use and all crucial
* controllers are accounted for
* controllers are accounted for
*/
*/
...
@@ -1156,7 +1173,8 @@ static void *cgfsng_init(const char *name)
...
@@ -1156,7 +1173,8 @@ static void *cgfsng_init(const char *name)
}
}
d
->
cgroup_pattern
=
must_copy_string
(
cgroup_pattern
);
d
->
cgroup_pattern
=
must_copy_string
(
cgroup_pattern
);
print_init_debuginfo
(
d
);
if
(
lxc_cgfsng_debug
)
lxc_cgfsng_print_debuginfo
(
d
);
return
d
;
return
d
;
...
@@ -1294,8 +1312,12 @@ static void cgfsng_destroy(void *hdata, struct lxc_conf *conf)
...
@@ -1294,8 +1312,12 @@ static void cgfsng_destroy(void *hdata, struct lxc_conf *conf)
struct
cgroup_ops
*
cgfsng_ops_init
(
void
)
struct
cgroup_ops
*
cgfsng_ops_init
(
void
)
{
{
if
(
getenv
(
"LXC_DEBUG_CGFSNG"
))
lxc_cgfsng_debug
=
true
;
if
(
!
collect_hierarchy_info
())
if
(
!
collect_hierarchy_info
())
return
NULL
;
return
NULL
;
return
&
cgfsng_ops
;
return
&
cgfsng_ops
;
}
}
...
...
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