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
5b353da9
Unverified
Commit
5b353da9
authored
Jan 31, 2019
by
Christian Brauner
Committed by
GitHub
Jan 31, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2806 from brauner/2019-01-27/bugfixes
freezer: non-functional changes
parents
9fc6fd21
02f71d7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
freezer.c
src/lxc/freezer.c
+7
-5
lxccontainer.c
src/lxc/lxccontainer.c
+6
-12
No files found.
src/lxc/freezer.c
View file @
5b353da9
...
@@ -51,11 +51,11 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
...
@@ -51,11 +51,11 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
int
ret
;
int
ret
;
char
v
[
100
];
char
v
[
100
];
struct
cgroup_ops
*
cgroup_ops
;
struct
cgroup_ops
*
cgroup_ops
;
const
char
*
state
;
const
char
*
state
;
size_t
state_len
;
size_t
state_len
;
lxc_state_t
new_state
=
freeze
?
FROZEN
:
THAWED
;
lxc_state_t
new_state
=
freeze
?
FROZEN
:
THAWED
;
state
=
lxc_state2str
(
new_state
);
state
=
lxc_state2str
(
new_state
);
state_len
=
strlen
(
state
);
state_len
=
strlen
(
state
);
cgroup_ops
=
cgroup_init
(
conf
);
cgroup_ops
=
cgroup_init
(
conf
);
...
@@ -65,19 +65,21 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
...
@@ -65,19 +65,21 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
ret
=
cgroup_ops
->
set
(
cgroup_ops
,
"freezer.state"
,
state
,
name
,
lxcpath
);
ret
=
cgroup_ops
->
set
(
cgroup_ops
,
"freezer.state"
,
state
,
name
,
lxcpath
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
cgroup_exit
(
cgroup_ops
);
cgroup_exit
(
cgroup_ops
);
ERROR
(
"Failed to %s %s"
,
(
new_state
==
FROZEN
?
"freeze"
:
"unfreeze"
),
name
);
ERROR
(
"Failed to %s %s"
,
(
new_state
==
FROZEN
?
"freeze"
:
"unfreeze"
),
name
);
return
-
1
;
return
-
1
;
}
}
for
(;;)
{
for
(;;)
{
ret
=
cgroup_ops
->
get
(
cgroup_ops
,
"freezer.state"
,
v
,
sizeof
(
v
),
name
,
lxcpath
);
ret
=
cgroup_ops
->
get
(
cgroup_ops
,
"freezer.state"
,
v
,
sizeof
(
v
),
name
,
lxcpath
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
cgroup_exit
(
cgroup_ops
);
cgroup_exit
(
cgroup_ops
);
ERROR
(
"Failed to get freezer state of %s"
,
name
);
ERROR
(
"Failed to get freezer state of %s"
,
name
);
return
-
1
;
return
-
1
;
}
}
v
[
sizeof
(
v
)
-
1
]
=
'\0'
;
v
[
sizeof
(
v
)
-
1
]
=
'\0'
;
v
[
lxc_char_right_gc
(
v
,
strlen
(
v
))]
=
'\0'
;
v
[
lxc_char_right_gc
(
v
,
strlen
(
v
))]
=
'\0'
;
ret
=
strncmp
(
v
,
state
,
state_len
);
ret
=
strncmp
(
v
,
state
,
state_len
);
...
...
src/lxc/lxccontainer.c
View file @
5b353da9
...
@@ -527,15 +527,12 @@ static bool do_lxcapi_freeze(struct lxc_container *c)
...
@@ -527,15 +527,12 @@ static bool do_lxcapi_freeze(struct lxc_container *c)
int
ret
;
int
ret
;
lxc_state_t
s
;
lxc_state_t
s
;
if
(
!
c
)
if
(
!
c
||
!
c
->
lxc_conf
)
return
false
;
return
false
;
s
=
lxc_getstate
(
c
->
name
,
c
->
config_path
);
s
=
lxc_getstate
(
c
->
name
,
c
->
config_path
);
if
(
s
!=
FROZEN
)
{
if
(
s
!=
FROZEN
)
ret
=
lxc_freeze
(
c
->
lxc_conf
,
c
->
name
,
c
->
config_path
);
return
lxc_freeze
(
c
->
lxc_conf
,
c
->
name
,
c
->
config_path
)
==
0
;
if
(
ret
<
0
)
return
false
;
}
return
true
;
return
true
;
}
}
...
@@ -547,15 +544,12 @@ static bool do_lxcapi_unfreeze(struct lxc_container *c)
...
@@ -547,15 +544,12 @@ static bool do_lxcapi_unfreeze(struct lxc_container *c)
int
ret
;
int
ret
;
lxc_state_t
s
;
lxc_state_t
s
;
if
(
!
c
)
if
(
!
c
||
!
c
->
lxc_conf
)
return
false
;
return
false
;
s
=
lxc_getstate
(
c
->
name
,
c
->
config_path
);
s
=
lxc_getstate
(
c
->
name
,
c
->
config_path
);
if
(
s
==
FROZEN
)
{
if
(
s
==
FROZEN
)
ret
=
lxc_unfreeze
(
c
->
lxc_conf
,
c
->
name
,
c
->
config_path
);
return
lxc_unfreeze
(
c
->
lxc_conf
,
c
->
name
,
c
->
config_path
)
==
0
;
if
(
ret
<
0
)
return
false
;
}
return
true
;
return
true
;
}
}
...
...
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