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
ed8e8611
Commit
ed8e8611
authored
Oct 27, 2016
by
Christian Brauner
Committed by
Stéphane Graber
Nov 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf, start: improve log output
Signed-off-by:
Christian Brauner
<
christian.brauner@canonical.com
>
parent
671c3c49
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
conf.c
src/lxc/conf.c
+1
-1
start.c
src/lxc/start.c
+17
-9
No files found.
src/lxc/conf.c
View file @
ed8e8611
...
@@ -3047,7 +3047,7 @@ int lxc_assign_network(const char *lxcpath, char *lxcname,
...
@@ -3047,7 +3047,7 @@ int lxc_assign_network(const char *lxcpath, char *lxcname,
return
-
1
;
return
-
1
;
}
}
DEBUG
(
"move '%s'
to '%d'"
,
netdev
->
name
,
pid
);
DEBUG
(
"move '%s'
/'%s' to '%d': ."
,
ifname
,
netdev
->
name
,
pid
);
}
}
return
0
;
return
0
;
...
...
src/lxc/start.c
View file @
ed8e8611
...
@@ -754,6 +754,8 @@ static int do_start(void *data)
...
@@ -754,6 +754,8 @@ static int do_start(void *data)
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYSERROR
(
"Error unsharing network namespace"
);
SYSERROR
(
"Error unsharing network namespace"
);
goto
out_warn_father
;
goto
out_warn_father
;
}
else
{
INFO
(
"Unshared NET namespace."
);
}
}
}
}
...
@@ -1030,33 +1032,35 @@ static int recv_ttys_from_child(struct lxc_handler *handler)
...
@@ -1030,33 +1032,35 @@ static int recv_ttys_from_child(struct lxc_handler *handler)
void
resolve_clone_flags
(
struct
lxc_handler
*
handler
)
void
resolve_clone_flags
(
struct
lxc_handler
*
handler
)
{
{
handler
->
clone_flags
=
CLONE_NEWPID
|
CLONE_NEWNS
;
handler
->
clone_flags
=
CLONE_NEWPID
|
CLONE_NEWNS
;
INFO
(
"Adding CLONE_NEWPID to clone flags."
);
INFO
(
"Adding CLONE_NEWNS to clone flags."
);
if
(
!
lxc_list_empty
(
&
handler
->
conf
->
id_map
))
{
if
(
!
lxc_list_empty
(
&
handler
->
conf
->
id_map
))
{
INFO
(
"
Cloning a new USER namespace
"
);
INFO
(
"
Adding CLONE_NEWUSER to clone flags.
"
);
handler
->
clone_flags
|=
CLONE_NEWUSER
;
handler
->
clone_flags
|=
CLONE_NEWUSER
;
}
}
if
(
handler
->
conf
->
inherit_ns_fd
[
LXC_NS_NET
]
==
-
1
)
{
if
(
handler
->
conf
->
inherit_ns_fd
[
LXC_NS_NET
]
==
-
1
)
{
if
(
!
lxc_requests_empty_network
(
handler
))
{
if
(
!
lxc_requests_empty_network
(
handler
))
{
INFO
(
"
Cloning a new NET namespace
"
);
INFO
(
"
Adding CLONE_NEWNET to clone flags.
"
);
handler
->
clone_flags
|=
CLONE_NEWNET
;
handler
->
clone_flags
|=
CLONE_NEWNET
;
}
}
}
else
{
}
else
{
INFO
(
"Inheriting a NET namespace"
);
INFO
(
"Inheriting a NET namespace
.
"
);
}
}
if
(
handler
->
conf
->
inherit_ns_fd
[
LXC_NS_IPC
]
==
-
1
)
{
if
(
handler
->
conf
->
inherit_ns_fd
[
LXC_NS_IPC
]
==
-
1
)
{
INFO
(
"
Cloning a new IPC namespace
"
);
INFO
(
"
Adding CLONE_NEWIPC to clone flags.
"
);
handler
->
clone_flags
|=
CLONE_NEWIPC
;
handler
->
clone_flags
|=
CLONE_NEWIPC
;
}
else
{
}
else
{
INFO
(
"Inheriting an IPC namespace"
);
INFO
(
"Inheriting an IPC namespace
.
"
);
}
}
if
(
handler
->
conf
->
inherit_ns_fd
[
LXC_NS_UTS
]
==
-
1
)
{
if
(
handler
->
conf
->
inherit_ns_fd
[
LXC_NS_UTS
]
==
-
1
)
{
INFO
(
"
Cloning a new UTS namespace
"
);
INFO
(
"
Adding CLONE_NEWUTS to clone flags.
"
);
handler
->
clone_flags
|=
CLONE_NEWUTS
;
handler
->
clone_flags
|=
CLONE_NEWUTS
;
}
else
{
}
else
{
INFO
(
"Inheriting a UTS namespace"
);
INFO
(
"Inheriting a UTS namespace
.
"
);
}
}
}
}
...
@@ -1163,8 +1167,10 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1163,8 +1167,10 @@ static int lxc_spawn(struct lxc_handler *handler)
flags
&=
~
CLONE_NEWNET
;
flags
&=
~
CLONE_NEWNET
;
handler
->
pid
=
lxc_clone
(
do_start
,
handler
,
flags
);
handler
->
pid
=
lxc_clone
(
do_start
,
handler
,
flags
);
if
(
handler
->
pid
<
0
)
{
if
(
handler
->
pid
<
0
)
{
SYSERROR
(
"
failed to fork into a new namespace
"
);
SYSERROR
(
"
Failed to fork into a set of new namespaces.
"
);
goto
out_delete_net
;
goto
out_delete_net
;
}
else
{
INFO
(
"Cloned a set of new namespaces."
);
}
}
if
(
!
preserve_ns
(
handler
->
nsfd
,
handler
->
clone_flags
|
preserve_mask
,
handler
->
pid
,
&
errmsg
))
{
if
(
!
preserve_ns
(
handler
->
nsfd
,
handler
->
clone_flags
|
preserve_mask
,
handler
->
pid
,
&
errmsg
))
{
...
@@ -1343,8 +1349,10 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
...
@@ -1343,8 +1349,10 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
/* if the backing store is a device, mount it here and now */
/* if the backing store is a device, mount it here and now */
if
(
rootfs_is_blockdev
(
conf
))
{
if
(
rootfs_is_blockdev
(
conf
))
{
if
(
unshare
(
CLONE_NEWNS
)
<
0
)
{
if
(
unshare
(
CLONE_NEWNS
)
<
0
)
{
ERROR
(
"Error unsharing
mounts
"
);
ERROR
(
"Error unsharing
MOUNT namespace.
"
);
goto
out_fini_nonet
;
goto
out_fini_nonet
;
}
else
{
INFO
(
"Unshared MOUNT namespace."
);
}
}
remount_all_slave
();
remount_all_slave
();
if
(
do_rootfs_setup
(
conf
,
name
,
lxcpath
)
<
0
)
{
if
(
do_rootfs_setup
(
conf
,
name
,
lxcpath
)
<
0
)
{
...
...
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