Commit 98b55414 authored by Ruslan Kuprieiev's avatar Ruslan Kuprieiev Committed by Pavel Emelyanov

v2 rpc: change some "required" fields to "optional"

The most of fields are to be changed to "optional", because they are
optional in fact.
Signed-off-by: 's avatarRuslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 551cd032
...@@ -86,9 +86,6 @@ static int setup_dump_from_req(CriuDumpReq *req) ...@@ -86,9 +86,6 @@ static int setup_dump_from_req(CriuDumpReq *req)
cr_service_client->pid = ids.pid; cr_service_client->pid = ids.pid;
cr_service_client->uid = ids.uid; cr_service_client->uid = ids.uid;
if (req->pid == 0)
req->pid = ids.pid;
if (fstat(cr_service_client->sk_fd, &st)) { if (fstat(cr_service_client->sk_fd, &st)) {
pr_perror("Can't get socket stat"); pr_perror("Can't get socket stat");
return -1; return -1;
...@@ -120,14 +117,28 @@ static int setup_dump_from_req(CriuDumpReq *req) ...@@ -120,14 +117,28 @@ static int setup_dump_from_req(CriuDumpReq *req)
} }
/* checking dump flags from client */ /* checking dump flags from client */
if (req->leave_running) if (req->has_leave_running && req->leave_running)
opts.final_state = TASK_ALIVE; opts.final_state = TASK_ALIVE;
opts.ext_unix_sk = req->ext_unix_sk; if (!req->has_pid) {
opts.tcp_established_ok = req->tcp_established; req->has_pid = true;
opts.evasive_devices = req->evasive_devices; req->pid = ids.pid;
opts.shell_job = req->shell_job; }
opts.handle_file_locks = req->file_locks;
if (req->has_ext_unix_sk)
opts.ext_unix_sk = req->ext_unix_sk;
if (req->has_tcp_established)
opts.tcp_established_ok = req->tcp_established;
if (req->has_evasive_devices)
opts.evasive_devices = req->evasive_devices;
if (req->has_shell_job)
opts.shell_job = req->shell_job;
if (req->has_file_locks)
opts.handle_file_locks = req->file_locks;
return 0; return 0;
} }
...@@ -149,7 +160,7 @@ static int dump_using_req(CriuDumpReq *req) ...@@ -149,7 +160,7 @@ static int dump_using_req(CriuDumpReq *req)
resp.success = true; resp.success = true;
exit: exit:
if (req->leave_running) { if (req->has_leave_running && req->leave_running) {
if (send_criu_dump_resp(cr_service_client->sk_fd, if (send_criu_dump_resp(cr_service_client->sk_fd,
&resp) == -1) { &resp) == -1) {
pr_perror("Can't send response"); pr_perror("Can't send response");
......
message criu_dump_req { message criu_dump_req {
required int32 pid = 1; //if not set, will dump requesting process optional int32 pid = 1; //if not set, will dump requesting process
required bool leave_running = 2; optional bool leave_running = 2;
required bool ext_unix_sk = 3; optional bool ext_unix_sk = 3;
required bool tcp_established = 4; optional bool tcp_established = 4;
required bool evasive_devices = 5; optional bool evasive_devices = 5;
required bool shell_job = 6; optional bool shell_job = 6;
required bool file_locks = 7; optional bool file_locks = 7;
required int32 images_dir_fd = 8; required int32 images_dir_fd = 8;
required int32 log_level = 9 [default = 2]; optional int32 log_level = 9 [default = 2];
} }
message criu_dump_resp { message criu_dump_resp {
required bool success = 1; required bool success = 1;
required bool restored = 2; optional bool restored = 2;
} }
message criu_msg { message criu_msg {
......
...@@ -753,8 +753,9 @@ static int open_unixsk_standalone(struct unix_sk_info *ui) ...@@ -753,8 +753,9 @@ static int open_unixsk_standalone(struct unix_sk_info *ui)
int sks[2]; int sks[2];
CriuDumpResp resp = CRIU_DUMP_RESP__INIT; CriuDumpResp resp = CRIU_DUMP_RESP__INIT;
resp.success = true; resp.success = true;
resp.restored = true; resp.has_restored = true;
resp.restored = true;
if (socketpair(PF_UNIX, ui->ue->type, 0, sks)) { if (socketpair(PF_UNIX, ui->ue->type, 0, sks)) {
pr_perror("Can't create socketpair"); pr_perror("Can't create socketpair");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment