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
068aa488
Unverified
Commit
068aa488
authored
Nov 28, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: make storage_dir() smart
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
Signed-off-by:
Adrian Reber
<
areber@redhat.com
>
parent
70d6bd97
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
lxccontainer.c
src/lxc/lxccontainer.c
+1
-1
storage.c
src/lxc/storage/storage.c
+6
-2
storage.h
src/lxc/storage/storage.h
+13
-1
No files found.
src/lxc/lxccontainer.c
View file @
068aa488
...
...
@@ -3802,7 +3802,7 @@ static int do_lxcapi_snapshot(struct lxc_container *c, const char *commentfile)
*/
flags
=
LXC_CLONE_SNAPSHOT
|
LXC_CLONE_KEEPMACADDR
|
LXC_CLONE_KEEPNAME
|
LXC_CLONE_KEEPBDEVTYPE
|
LXC_CLONE_MAYBE_SNAPSHOT
;
if
(
storage_is_dir
(
c
->
lxc_conf
,
c
->
lxc_conf
->
rootfs
.
path
))
{
if
(
storage_is_dir
(
c
->
lxc_conf
))
{
ERROR
(
"Snapshot of directory-backed container requested."
);
ERROR
(
"Making a copy-clone. If you do want snapshots, then"
);
ERROR
(
"please create an aufs or overlay clone first, snapshot that"
);
...
...
src/lxc/storage/storage.c
View file @
068aa488
...
...
@@ -650,12 +650,16 @@ struct lxc_storage *storage_init(struct lxc_conf *conf, const char *src,
return
bdev
;
}
bool
storage_is_dir
(
struct
lxc_conf
*
conf
,
const
char
*
path
)
bool
storage_is_dir
(
struct
lxc_conf
*
conf
)
{
struct
lxc_storage
*
orig
;
char
*
type
=
conf
->
rootfs
.
bdev_type
;
bool
bret
=
false
;
orig
=
storage_init
(
conf
,
path
,
NULL
,
NULL
);
if
(
type
)
return
(
strcmp
(
type
,
"dir"
)
==
0
);
orig
=
storage_init
(
conf
,
conf
->
lxc_rootfs
.
path
,
NULL
,
NULL
);
if
(
!
orig
)
return
bret
;
...
...
src/lxc/storage/storage.h
View file @
068aa488
...
...
@@ -109,7 +109,19 @@ struct lxc_storage {
int
flags
;
};
extern
bool
storage_is_dir
(
struct
lxc_conf
*
conf
,
const
char
*
path
);
/**
* storage_is_dir : Check whether the roots is a directory. This function will
* trust the config file. If the config file key
* lxc.rootfs.path is set to <storage type>:<container path>
* the confile parser will have split this into <storage type>
* and <container path> and set the <bdev_type> member in the
* lxc_rootfs struct to <storage type> and the <path> member
* will be set to a clean <container path> without the <storage
* type> prefix. This is the new, clean way of handling storage
* type specifications. If the <storage type> prefix is not
* detected liblxc will try to detect the storage type.
*/
extern
bool
storage_is_dir
(
struct
lxc_conf
*
conf
);
extern
bool
storage_can_backup
(
struct
lxc_conf
*
conf
);
/* Instantiate a lxc_storage object. The src is used to determine which blockdev
...
...
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