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
d91adfa6
Unverified
Commit
d91adfa6
authored
Nov 15, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: add lxc.console.rotate
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
3a784510
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
2 deletions
+62
-2
lxc.container.conf.sgml.in
doc/lxc.container.conf.sgml.in
+28
-2
conf.h
src/lxc/conf.h
+1
-0
confile.c
src/lxc/confile.c
+33
-0
No files found.
doc/lxc.container.conf.sgml.in
View file @
d91adfa6
...
@@ -733,11 +733,37 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
...
@@ -733,11 +733,37 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</term>
</term>
<listitem>
<listitem>
<para>
<para>
Specify a path to a file where the console output will
Specify a path to a file where the console output will be written.
be written.
Note that in contrast to the on-disk ringbuffer logfile this file
will keep growing potentially filling up the users disks if not
rotated and deleted. This problem can also be avoided by using the
in-memory ringbuffer options
<option>lxc.console.buffer.size</option> and
<option>lxc.console.buffer.logfile</option>.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<term>
<option>lxc.console.rotate</option>
</term>
<listitem>
<para>
Whether to rotate the console logfile specified in
<option>lxc.console.logfile</option>. Users can send an API
request to rotate the logfile. Note that the old logfile will have
the same name as the original with the suffix ".1" appended.
Users wishing to prevent the console log file from filling the
disk should rotate the logfile and delete it if unneeded. This
problem can also be avoided by using the in-memory ringbuffer
options <option>lxc.console.buffer.size</option> and
<option>lxc.console.buffer.logfile</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<varlistentry>
<term>
<term>
<option>lxc.console.path</option>
<option>lxc.console.path</option>
...
...
src/lxc/conf.h
View file @
d91adfa6
...
@@ -150,6 +150,7 @@ struct lxc_console {
...
@@ -150,6 +150,7 @@ struct lxc_console {
char
*
path
;
char
*
path
;
char
*
log_path
;
char
*
log_path
;
int
log_fd
;
int
log_fd
;
unsigned
int
log_rotate
;
char
name
[
MAXPATHLEN
];
char
name
[
MAXPATHLEN
];
struct
termios
*
tios
;
struct
termios
*
tios
;
struct
lxc_tty_state
*
tty_state
;
struct
lxc_tty_state
*
tty_state
;
...
...
src/lxc/confile.c
View file @
d91adfa6
...
@@ -83,6 +83,7 @@ lxc_config_define(cap_keep);
...
@@ -83,6 +83,7 @@ lxc_config_define(cap_keep);
lxc_config_define
(
cgroup_controller
);
lxc_config_define
(
cgroup_controller
);
lxc_config_define
(
cgroup_dir
);
lxc_config_define
(
cgroup_dir
);
lxc_config_define
(
console_logfile
);
lxc_config_define
(
console_logfile
);
lxc_config_define
(
console_rotate
);
lxc_config_define
(
console_buffer_logfile
);
lxc_config_define
(
console_buffer_logfile
);
lxc_config_define
(
console_buffer_size
);
lxc_config_define
(
console_buffer_size
);
lxc_config_define
(
console_path
);
lxc_config_define
(
console_path
);
...
@@ -154,6 +155,7 @@ static struct lxc_config_t config[] = {
...
@@ -154,6 +155,7 @@ static struct lxc_config_t config[] = {
{
"lxc.console.buffer.size"
,
false
,
set_config_console_buffer_size
,
get_config_console_buffer_size
,
clr_config_console_buffer_size
,
},
{
"lxc.console.buffer.size"
,
false
,
set_config_console_buffer_size
,
get_config_console_buffer_size
,
clr_config_console_buffer_size
,
},
{
"lxc.console.logfile"
,
false
,
set_config_console_logfile
,
get_config_console_logfile
,
clr_config_console_logfile
,
},
{
"lxc.console.logfile"
,
false
,
set_config_console_logfile
,
get_config_console_logfile
,
clr_config_console_logfile
,
},
{
"lxc.console.path"
,
false
,
set_config_console_path
,
get_config_console_path
,
clr_config_console_path
,
},
{
"lxc.console.path"
,
false
,
set_config_console_path
,
get_config_console_path
,
clr_config_console_path
,
},
{
"lxc.console.rotate"
,
false
,
set_config_console_rotate
,
get_config_console_rotate
,
clr_config_console_rotate
,
},
{
"lxc.environment"
,
false
,
set_config_environment
,
get_config_environment
,
clr_config_environment
,
},
{
"lxc.environment"
,
false
,
set_config_environment
,
get_config_environment
,
clr_config_environment
,
},
{
"lxc.ephemeral"
,
false
,
set_config_ephemeral
,
get_config_ephemeral
,
clr_config_ephemeral
,
},
{
"lxc.ephemeral"
,
false
,
set_config_ephemeral
,
get_config_ephemeral
,
clr_config_ephemeral
,
},
{
"lxc.execute.cmd"
,
false
,
set_config_execute_cmd
,
get_config_execute_cmd
,
clr_config_execute_cmd
,
},
{
"lxc.execute.cmd"
,
false
,
set_config_execute_cmd
,
get_config_execute_cmd
,
clr_config_execute_cmd
,
},
...
@@ -1790,6 +1792,23 @@ static int set_config_console_path(const char *key, const char *value,
...
@@ -1790,6 +1792,23 @@ static int set_config_console_path(const char *key, const char *value,
return
set_config_path_item
(
&
lxc_conf
->
console
.
path
,
value
);
return
set_config_path_item
(
&
lxc_conf
->
console
.
path
,
value
);
}
}
static
int
set_config_console_rotate
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
console
.
log_rotate
=
0
;
return
0
;
}
if
(
lxc_safe_uint
(
value
,
&
lxc_conf
->
console
.
log_rotate
)
<
0
)
return
-
1
;
if
(
lxc_conf
->
console
.
log_rotate
>
1
)
return
-
1
;
return
0
;
}
static
int
set_config_console_logfile
(
const
char
*
key
,
const
char
*
value
,
static
int
set_config_console_logfile
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
{
...
@@ -3100,6 +3119,13 @@ static int get_config_console_logfile(const char *key, char *retv, int inlen,
...
@@ -3100,6 +3119,13 @@ static int get_config_console_logfile(const char *key, char *retv, int inlen,
return
lxc_get_conf_str
(
retv
,
inlen
,
c
->
console
.
log_path
);
return
lxc_get_conf_str
(
retv
,
inlen
,
c
->
console
.
log_path
);
}
}
static
int
get_config_console_rotate
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
console
.
log_rotate
);
}
static
int
get_config_console_buffer_size
(
const
char
*
key
,
char
*
retv
,
static
int
get_config_console_buffer_size
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
void
*
data
)
...
@@ -3518,6 +3544,13 @@ static inline int clr_config_console_logfile(const char *key,
...
@@ -3518,6 +3544,13 @@ static inline int clr_config_console_logfile(const char *key,
return
0
;
return
0
;
}
}
static
inline
int
clr_config_console_rotate
(
const
char
*
key
,
struct
lxc_conf
*
c
,
void
*
data
)
{
c
->
console
.
log_rotate
=
0
;
return
0
;
}
static
inline
int
clr_config_console_buffer_size
(
const
char
*
key
,
static
inline
int
clr_config_console_buffer_size
(
const
char
*
key
,
struct
lxc_conf
*
c
,
void
*
data
)
struct
lxc_conf
*
c
,
void
*
data
)
{
{
...
...
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