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
33ba4ad7
Commit
33ba4ad7
authored
Jan 14, 2010
by
Cedric Le Goater
Committed by
Daniel Lezcano
Jan 14, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc: add --define to start
Signed-off-by:
Cedric Le Goater
<
clg@fr.ibm.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
a31b2048
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
lxc-start.sgml.in
doc/lxc-start.sgml.in
+15
-1
lxc_start.c
src/lxc/lxc_start.c
+11
-1
No files found.
doc/lxc-start.sgml.in
View file @
33ba4ad7
...
@@ -49,7 +49,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
...
@@ -49,7 +49,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<refsynopsisdiv>
<refsynopsisdiv>
<cmdsynopsis><command>lxc-start <replaceable>-n
<cmdsynopsis><command>lxc-start <replaceable>-n
name</replaceable> <optional>-f
name</replaceable> <optional>-f
config_file</optional> <optional>command</optional></command></cmdsynopsis>
config_file</optional> <optional>-s KEY=VAL</optional>
<optional>command</optional></command></cmdsynopsis>
</refsynopsisdiv>
</refsynopsisdiv>
<refsect1>
<refsect1>
...
@@ -105,6 +106,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
...
@@ -105,6 +106,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</listitem>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<term>
<option>-s <replaceable>KEY=VAL</replaceable></option>
</term>
<listitem>
<para>
Assign value <replaceable>VAL</replaceable> to configuration
variable <replaceable>KEY</replaceable>. This overrides any
assignment done in <replaceable>config_file</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</variablelist>
</refsect1>
</refsect1>
...
...
src/lxc/lxc_start.c
View file @
33ba4ad7
...
@@ -50,11 +50,14 @@
...
@@ -50,11 +50,14 @@
lxc_log_define
(
lxc_start_ui
,
lxc_start
);
lxc_log_define
(
lxc_start_ui
,
lxc_start
);
static
struct
lxc_list
defines
;
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
{
{
switch
(
c
)
{
switch
(
c
)
{
case
'd'
:
args
->
daemonize
=
1
;
break
;
case
'd'
:
args
->
daemonize
=
1
;
break
;
case
'f'
:
args
->
rcfile
=
arg
;
break
;
case
'f'
:
args
->
rcfile
=
arg
;
break
;
case
's'
:
return
lxc_config_define_add
(
&
defines
,
arg
);
}
}
return
0
;
return
0
;
}
}
...
@@ -62,6 +65,7 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
...
@@ -62,6 +65,7 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
static
const
struct
option
my_longopts
[]
=
{
static
const
struct
option
my_longopts
[]
=
{
{
"daemon"
,
no_argument
,
0
,
'd'
},
{
"daemon"
,
no_argument
,
0
,
'd'
},
{
"rcfile"
,
required_argument
,
0
,
'f'
},
{
"rcfile"
,
required_argument
,
0
,
'f'
},
{
"define"
,
required_argument
,
0
,
's'
},
LXC_COMMON_OPTIONS
LXC_COMMON_OPTIONS
};
};
...
@@ -75,7 +79,8 @@ lxc-start start COMMAND in specified container NAME\n\
...
@@ -75,7 +79,8 @@ lxc-start start COMMAND in specified container NAME\n\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME for name of the container
\n
\
-n, --name=NAME NAME for name of the container
\n
\
-d, --daemon daemonize the container
\n
\
-d, --daemon daemonize the container
\n
\
-f, --rcfile=FILE Load configuration file FILE
\n
"
,
-f, --rcfile=FILE Load configuration file FILE
\n
\
-s, --define KEY=VAL Assign VAL to configuration variable KEY
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -135,6 +140,8 @@ int main(int argc, char *argv[])
...
@@ -135,6 +140,8 @@ int main(int argc, char *argv[])
char
*
rcfile
=
NULL
;
char
*
rcfile
=
NULL
;
struct
lxc_conf
*
conf
;
struct
lxc_conf
*
conf
;
lxc_list_init
(
&
defines
);
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
return
err
;
return
err
;
...
@@ -174,6 +181,9 @@ int main(int argc, char *argv[])
...
@@ -174,6 +181,9 @@ int main(int argc, char *argv[])
return
err
;
return
err
;
}
}
if
(
lxc_config_define_load
(
&
defines
,
conf
))
return
err
;
if
(
!
rcfile
&&
!
strcmp
(
"/sbin/init"
,
args
[
0
]))
{
if
(
!
rcfile
&&
!
strcmp
(
"/sbin/init"
,
args
[
0
]))
{
ERROR
(
"no configuration file for '/sbin/init' (may crash the host)"
);
ERROR
(
"no configuration file for '/sbin/init' (may crash the host)"
);
return
err
;
return
err
;
...
...
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