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
70f3eb4e
Commit
70f3eb4e
authored
May 24, 2014
by
S.Çağlar Onur
Committed by
Stéphane Graber
Jun 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
destroy the original container after making sure the snapshot exists (fixes #224)
Signed-off-by:
S.Çağlar Onur
<
caglar@10ur.org
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
35d0ebf1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
lxccontainer.c
src/lxc/lxccontainer.c
+10
-7
No files found.
src/lxc/lxccontainer.c
View file @
70f3eb4e
...
...
@@ -3090,13 +3090,7 @@ static bool lxcapi_snapshot_restore(struct lxc_container *c, const char *snapnam
if
(
!
newname
)
newname
=
c
->
name
;
if
(
strcmp
(
c
->
name
,
newname
)
==
0
)
{
if
(
!
lxcapi_destroy
(
c
))
{
ERROR
(
"Could not destroy existing container %s"
,
newname
);
bdev_put
(
bdev
);
return
false
;
}
}
ret
=
snprintf
(
clonelxcpath
,
MAXPATHLEN
,
"%ssnaps/%s"
,
c
->
config_path
,
c
->
name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
bdev_put
(
bdev
);
...
...
@@ -3112,6 +3106,15 @@ static bool lxcapi_snapshot_restore(struct lxc_container *c, const char *snapnam
return
false
;
}
if
(
strcmp
(
c
->
name
,
newname
)
==
0
)
{
if
(
!
lxcapi_destroy
(
c
))
{
ERROR
(
"Could not destroy existing container %s"
,
newname
);
lxc_container_put
(
snap
);
bdev_put
(
bdev
);
return
false
;
}
}
if
(
strcmp
(
bdev
->
type
,
"dir"
)
!=
0
&&
strcmp
(
bdev
->
type
,
"loop"
)
!=
0
)
flags
=
LXC_CLONE_SNAPSHOT
|
LXC_CLONE_MAYBE_SNAPSHOT
;
rest
=
lxcapi_clone
(
snap
,
newname
,
c
->
config_path
,
flags
,
...
...
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