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
09f6f8c4
Unverified
Commit
09f6f8c4
authored
Nov 28, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
overlay: adapt to new config rootfs parser
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
Signed-off-by:
Adrian Reber
<
areber@redhat.com
>
parent
63c9ffa0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
32 deletions
+27
-32
lxccontainer.c
src/lxc/lxccontainer.c
+2
-2
overlay.c
src/lxc/storage/overlay.c
+20
-25
storage.c
src/lxc/storage/storage.c
+5
-5
No files found.
src/lxc/lxccontainer.c
View file @
09f6f8c4
...
...
@@ -4054,8 +4054,8 @@ static bool do_lxcapi_snapshot_restore(struct lxc_container *c, const char *snap
if
(
!
strcmp
(
bdev
->
type
,
"overlay"
)
||
!
strcmp
(
bdev
->
type
,
"overlayfs"
))
flags
|=
LXC_STORAGE_INTERNAL_OVERLAY_RESTORE
;
rest
=
lxcapi_clone
(
snap
,
newname
,
c
->
config_path
,
flags
,
bdev
->
type
,
NULL
,
0
,
NULL
);
rest
=
lxcapi_clone
(
snap
,
newname
,
c
->
config_path
,
flags
,
bdev
->
type
,
NULL
,
0
,
NULL
);
storage_put
(
bdev
);
if
(
rest
&&
lxcapi_is_defined
(
rest
))
b
=
true
;
...
...
src/lxc/storage/overlay.c
View file @
09f6f8c4
...
...
@@ -199,12 +199,11 @@ int ovl_clonepaths(struct lxc_storage *orig, struct lxc_storage *new, const char
return
-
22
;
}
nsrc
=
strchr
(
osrc
,
':'
)
+
1
;
if
((
nsrc
!=
osrc
+
8
)
&&
(
nsrc
!=
osrc
+
10
))
{
ERROR
(
"Detected
\"
:
\"
in
\"
%s
\"
at wrong position"
,
osrc
);
free
(
osrc
);
return
-
22
;
}
nsrc
=
osrc
;
if
(
strncmp
(
osrc
,
"overlay:"
,
8
)
==
0
)
nsrc
+=
8
;
else
if
(
strncmp
(
osrc
,
"overlayfs:"
,
10
)
==
0
)
nsrc
+=
10
;
odelta
=
strchr
(
nsrc
,
':'
);
if
(
!
odelta
)
{
...
...
@@ -457,22 +456,17 @@ int ovl_create(struct lxc_storage *bdev, const char *dest, const char *n,
int
ovl_destroy
(
struct
lxc_storage
*
orig
)
{
bool
ovl
;
char
*
upper
=
orig
->
src
;
ovl
=
!
strncmp
(
upper
,
"overlay:"
,
8
);
if
(
!
ovl
&&
strncmp
(
upper
,
"overlayfs:"
,
10
))
return
-
22
;
/* For an overlay container the rootfs is considered immutable
* and cannot be removed when restoring from a snapshot.
*/
if
(
orig
->
flags
&
LXC_STORAGE_INTERNAL_OVERLAY_RESTORE
)
return
0
;
if
(
ovl
)
if
(
strncmp
(
upper
,
"overlay:"
,
8
)
==
0
)
upper
+=
8
;
else
else
if
(
strncmp
(
upper
,
"overlayfs:"
,
10
)
==
0
)
upper
+=
10
;
upper
=
strchr
(
upper
,
':'
);
...
...
@@ -485,10 +479,10 @@ int ovl_destroy(struct lxc_storage *orig)
bool
ovl_detect
(
const
char
*
path
)
{
if
(
!
strncmp
(
path
,
"overlay
fs:"
,
10
))
if
(
!
strncmp
(
path
,
"overlay
:"
,
8
))
return
true
;
if
(
!
strncmp
(
path
,
"overlay
:"
,
8
))
if
(
!
strncmp
(
path
,
"overlay
fs:"
,
10
))
return
true
;
return
false
;
...
...
@@ -521,18 +515,19 @@ int ovl_mount(struct lxc_storage *bdev)
ERROR
(
"Failed to allocate memory"
);
return
-
1
;
}
upper
=
dup
;
lower
=
dup
;
/* support multiple lower layers */
lower
=
strstr
(
dup
,
":/"
);
if
(
!
lower
)
{
ERROR
(
"Failed to detect
\"
:/
\"
in string
\"
%s
\"
"
,
dup
);
free
(
dup
);
return
-
22
;
}
if
(
strncmp
(
dup
,
"overlay:"
,
8
)
==
0
)
lower
+=
8
;
else
if
(
strncmp
(
dup
,
"overlayfs:"
,
10
)
==
0
)
lower
+=
10
;
if
(
upper
!=
lower
)
upper
=
lower
;
lower
++
;
upper
=
lower
;
while
((
tmp
=
strstr
(
++
upper
,
":/"
)))
{
/* support multiple lower layers */
while
((
tmp
=
strstr
(
upper
,
":/"
)))
{
tmp
++
;
upper
=
tmp
;
}
...
...
src/lxc/storage/storage.c
View file @
09f6f8c4
...
...
@@ -268,10 +268,9 @@ struct lxc_storage *storage_get(const char *type)
size_t
i
;
struct
lxc_storage
*
bdev
;
for
(
i
=
0
;
i
<
numbdevs
;
i
++
)
{
for
(
i
=
0
;
i
<
numbdevs
;
i
++
)
if
(
strcmp
(
bdevs
[
i
].
name
,
type
)
==
0
)
break
;
}
if
(
i
==
numbdevs
)
return
NULL
;
...
...
@@ -284,7 +283,7 @@ struct lxc_storage *storage_get(const char *type)
bdev
->
ops
=
bdevs
[
i
].
ops
;
bdev
->
type
=
bdevs
[
i
].
name
;
if
(
!
strcmp
(
bdev
->
type
,
"aufs"
)
)
if
(
strcmp
(
bdev
->
type
,
"aufs"
)
==
0
)
WARN
(
"The
\"
aufs
\"
driver will is deprecated and will soon be "
"removed. For similar functionality see the
\"
overlay
\"
"
"storage driver"
);
...
...
@@ -296,7 +295,7 @@ static struct lxc_storage *do_storage_create(const char *dest, const char *type,
const
char
*
cname
,
struct
bdev_specs
*
specs
)
{
int
ret
;
struct
lxc_storage
*
bdev
;
if
(
!
type
)
...
...
@@ -306,7 +305,8 @@ static struct lxc_storage *do_storage_create(const char *dest, const char *type,
if
(
!
bdev
)
return
NULL
;
if
(
bdev
->
ops
->
create
(
bdev
,
dest
,
cname
,
specs
)
<
0
)
{
ret
=
bdev
->
ops
->
create
(
bdev
,
dest
,
cname
,
specs
);
if
(
ret
<
0
)
{
storage_put
(
bdev
);
return
NULL
;
}
...
...
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