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
241978fa
Unverified
Commit
241978fa
authored
Jul 28, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
overlay: rework overlay storage driver
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
3ef1df7c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
lxcoverlay.c
src/lxc/bdev/lxcoverlay.c
+0
-0
lxccontainer.c
src/lxc/lxccontainer.c
+37
-3
No files found.
src/lxc/bdev/lxcoverlay.c
View file @
241978fa
This diff is collapsed.
Click to expand it.
src/lxc/lxccontainer.c
View file @
241978fa
...
...
@@ -1263,11 +1263,45 @@ static bool create_run_template(struct lxc_container *c, char *tpath, bool need_
if
(
strcmp
(
bdev
->
type
,
"dir"
)
&&
strcmp
(
bdev
->
type
,
"btrfs"
))
{
if
(
geteuid
()
!=
0
)
{
ERROR
(
"non-root users can only create btrfs and directory-backed containers"
);
exit
(
1
);
exit
(
EXIT_FAILURE
);
}
if
(
!
strcmp
(
bdev
->
type
,
"overlay"
)
||
!
strcmp
(
bdev
->
type
,
"overlayfs"
))
{
/* If we create an overlay container we need to
* rsync the contents into
* <container-path>/<container-name>/rootfs.
* However, the overlay mount function will
* mount will mount
* <container-path>/<container-name>/delta0
* over
* <container-path>/<container-name>/rootfs
* which means we would rsync the rootfs into
* the delta directory. That doesn't make sense
* since the delta directory only exists to
* record the differences to
* <container-path>/<container-name>/rootfs. So
* let's simply bind-mount here and then rsync
* directly into
* <container-path>/<container-name>/rootfs.
*/
char
*
src
;
src
=
ovl_get_rootfs
(
bdev
->
src
,
&
(
size_t
){
0
});
if
(
!
src
)
{
ERROR
(
"Failed to get rootfs"
);
exit
(
EXIT_FAILURE
);
}
ret
=
mount
(
src
,
bdev
->
dest
,
"bind"
,
MS_BIND
|
MS_REC
,
NULL
);
if
(
ret
<
0
)
{
ERROR
(
"Failed to mount rootfs"
);
return
-
1
;
}
}
else
{
if
(
bdev
->
ops
->
mount
(
bdev
)
<
0
)
{
ERROR
(
"Error mounting rootfs"
);
exit
(
1
);
ERROR
(
"Failed to mount rootfs"
);
exit
(
EXIT_FAILURE
);
}
}
}
else
{
// TODO come up with a better way here!
char
*
src
;
...
...
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