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
771d96b3
Commit
771d96b3
authored
Oct 19, 2013
by
S.Çağlar Onur
Committed by
Serge Hallyn
Oct 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introduce snapshot_destroy
Signed-off-by:
S.Çağlar Onur
<
caglar@10ur.org
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
93ea85c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
lxccontainer.c
src/lxc/lxccontainer.c
+33
-0
lxccontainer.h
src/lxc/lxccontainer.h
+7
-0
No files found.
src/lxc/lxccontainer.c
View file @
771d96b3
...
...
@@ -2614,6 +2614,38 @@ static bool lxcapi_snapshot_restore(struct lxc_container *c, char *snapname, cha
return
b
;
}
static
bool
lxcapi_snapshot_destroy
(
struct
lxc_container
*
c
,
char
*
snapname
)
{
int
ret
;
char
clonelxcpath
[
MAXPATHLEN
];
struct
lxc_container
*
snap
=
NULL
;
if
(
!
c
||
!
c
->
name
||
!
c
->
config_path
)
return
false
;
ret
=
snprintf
(
clonelxcpath
,
MAXPATHLEN
,
"%ssnaps/%s"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
goto
err
;
snap
=
lxc_container_new
(
snapname
,
clonelxcpath
);
if
(
!
snap
||
!
lxcapi_is_defined
(
snap
))
{
ERROR
(
"Could not find snapshot %s"
,
snapname
);
goto
err
;
}
if
(
!
lxcapi_destroy
(
snap
))
{
ERROR
(
"Could not destroy snapshot %s"
,
snapname
);
goto
err
;
}
lxc_container_put
(
snap
);
return
true
;
err:
if
(
snap
)
lxc_container_put
(
snap
);
return
false
;
}
static
bool
lxcapi_may_control
(
struct
lxc_container
*
c
)
{
return
lxc_try_cmd
(
c
->
name
,
c
->
config_path
)
==
0
;
...
...
@@ -2738,6 +2770,7 @@ struct lxc_container *lxc_container_new(const char *name, const char *configpath
c
->
snapshot
=
lxcapi_snapshot
;
c
->
snapshot_list
=
lxcapi_snapshot_list
;
c
->
snapshot_restore
=
lxcapi_snapshot_restore
;
c
->
snapshot_destroy
=
lxcapi_snapshot_destroy
;
c
->
may_control
=
lxcapi_may_control
;
/* we'll allow the caller to update these later */
...
...
src/lxc/lxccontainer.h
View file @
771d96b3
...
...
@@ -225,6 +225,13 @@ struct lxc_container {
bool
(
*
snapshot_restore
)(
struct
lxc_container
*
c
,
char
*
snapname
,
char
*
newname
);
/*
* snapshot_destroy() will destroy the given snapshot of c
*
* Returns true on success, false on failure.
*/
bool
(
*
snapshot_destroy
)(
struct
lxc_container
*
c
,
char
*
snapname
);
/*
* Return false if there is a control socket for the container monitor,
* and the caller may not access it. Return true otherwise.
*/
...
...
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