mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
action-scripts: Add pre-stream hook
This hook allows to start image streamer process from an action script. Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
committed by
Andrei Vagin
parent
c6ac396aa3
commit
2ac15e3ad0
@@ -18,6 +18,7 @@
|
|||||||
#include "common/scm.h"
|
#include "common/scm.h"
|
||||||
|
|
||||||
static const char *action_names[ACT_MAX] = {
|
static const char *action_names[ACT_MAX] = {
|
||||||
|
[ACT_PRE_STREAM] = "pre-stream",
|
||||||
[ACT_PRE_DUMP] = "pre-dump",
|
[ACT_PRE_DUMP] = "pre-dump",
|
||||||
[ACT_POST_DUMP] = "post-dump",
|
[ACT_POST_DUMP] = "post-dump",
|
||||||
[ACT_PRE_RESTORE] = "pre-restore",
|
[ACT_PRE_RESTORE] = "pre-restore",
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#include "rst-malloc.h"
|
#include "rst-malloc.h"
|
||||||
#include "common/scm.h"
|
#include "common/scm.h"
|
||||||
#include "common/lock.h"
|
#include "common/lock.h"
|
||||||
|
#include "action-scripts.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use different path names for the dump and restore sockets because:
|
* We use different path names for the dump and restore sockets because:
|
||||||
@@ -49,10 +50,17 @@ static const char *socket_name_for_mode(int mode)
|
|||||||
int img_streamer_init(const char *image_dir, int mode)
|
int img_streamer_init(const char *image_dir, int mode)
|
||||||
{
|
{
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
|
int pre_stream_ret;
|
||||||
int sockfd;
|
int sockfd;
|
||||||
|
|
||||||
img_streamer_mode = mode;
|
img_streamer_mode = mode;
|
||||||
|
|
||||||
|
pre_stream_ret = run_scripts(ACT_PRE_STREAM);
|
||||||
|
if (pre_stream_ret != 0) {
|
||||||
|
pr_err("Pre-stream script failed with %d!\n", pre_stream_ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
if (sockfd < 0) {
|
if (sockfd < 0) {
|
||||||
pr_perror("Unable to instantiate UNIX socket");
|
pr_perror("Unable to instantiate UNIX socket");
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#include "asm/int.h"
|
#include "asm/int.h"
|
||||||
|
|
||||||
enum script_actions {
|
enum script_actions {
|
||||||
|
ACT_PRE_STREAM,
|
||||||
ACT_PRE_DUMP,
|
ACT_PRE_DUMP,
|
||||||
ACT_POST_DUMP,
|
ACT_POST_DUMP,
|
||||||
ACT_PRE_RESTORE,
|
ACT_PRE_RESTORE,
|
||||||
|
Reference in New Issue
Block a user