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
419847a8
Unverified
Commit
419847a8
authored
Feb 02, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freezer: use lxc_cmd_notify_state_listeners()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
241670e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
freezer.c
src/lxc/freezer.c
+6
-12
No files found.
src/lxc/freezer.c
View file @
419847a8
...
...
@@ -15,6 +15,7 @@
#include "cgroups/cgroup.h"
#include "cgroups/cgroup_utils.h"
#include "commands.h"
#include "commands_utils.h"
#include "config.h"
#include "error.h"
#include "log.h"
...
...
@@ -25,13 +26,6 @@
lxc_log_define
(
freezer
,
lxc
);
static
void
notify_state_listeners
(
const
char
*
name
,
const
char
*
lxcpath
,
lxc_state_t
state
)
{
(
void
)
lxc_cmd_serve_state_clients
(
name
,
lxcpath
,
state
);
(
void
)
lxc_monitor_send_state
(
name
,
state
,
lxcpath
);
}
static
int
do_freeze_thaw
(
bool
freeze
,
struct
lxc_conf
*
conf
,
const
char
*
name
,
const
char
*
lxcpath
)
{
...
...
@@ -64,7 +58,7 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
cur_state
[
lxc_char_right_gc
(
cur_state
,
strlen
(
cur_state
))]
=
'\0'
;
ret
=
strncmp
(
cur_state
,
state
,
state_len
);
if
(
ret
==
0
)
{
notify_state_listeners
(
name
,
lxcpath
,
new_state
);
lxc_cmd_
notify_state_listeners
(
name
,
lxcpath
,
new_state
);
return
0
;
}
...
...
@@ -78,12 +72,12 @@ int lxc_freeze(struct lxc_conf *conf, const char *name, const char *lxcpath)
{
int
ret
;
notify_state_listeners
(
name
,
lxcpath
,
FREEZING
);
lxc_cmd_
notify_state_listeners
(
name
,
lxcpath
,
FREEZING
);
if
(
unified_cgroup_hierarchy
()
>
0
)
ret
=
lxc_cmd_freeze
(
name
,
lxcpath
,
-
1
);
else
ret
=
do_freeze_thaw
(
true
,
conf
,
name
,
lxcpath
);
notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
FROZEN
:
RUNNING
);
lxc_cmd_
notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
FROZEN
:
RUNNING
);
return
ret
;
}
...
...
@@ -91,11 +85,11 @@ int lxc_unfreeze(struct lxc_conf *conf, const char *name, const char *lxcpath)
{
int
ret
;
notify_state_listeners
(
name
,
lxcpath
,
THAWED
);
lxc_cmd_
notify_state_listeners
(
name
,
lxcpath
,
THAWED
);
if
(
unified_cgroup_hierarchy
()
>
0
)
ret
=
lxc_cmd_unfreeze
(
name
,
lxcpath
,
-
1
);
else
ret
=
do_freeze_thaw
(
false
,
conf
,
name
,
lxcpath
);
notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
RUNNING
:
FROZEN
);
lxc_cmd_
notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
RUNNING
:
FROZEN
);
return
ret
;
}
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