Skip to content

Commit 3198a84

Browse files
committed
Hardcode CRIU verbosity to -v1 and drop the LUPINE_SNAPSHOT_ID env var
1 parent 3e6e165 commit 3198a84

2 files changed

Lines changed: 7 additions & 24 deletions

File tree

snapshot.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,9 @@ bool write_status(int fd, int result) {
218218
#endif
219219
}
220220

221-
// CRIU verbosity flag. Defaults to "-v1" (warnings + errors) instead of the
222-
// previous hard-coded "-v4": the verbose debug log is written while the target
223-
// process (and its GPU) are frozen, so trimming it shortens the freeze window.
224-
// Override with LUPINE_SNAPSHOT_CRIU_VERBOSITY (0-4) when debugging failures.
225-
std::string criu_verbosity_flag() {
226-
const char *level = getenv("LUPINE_SNAPSHOT_CRIU_VERBOSITY");
227-
char value = (level != nullptr && level[0] >= '0' && level[0] <= '4' &&
228-
level[1] == '\0')
229-
? level[0]
230-
: '1';
231-
return std::string("-v") + value;
232-
}
221+
// CRIU log verbosity: warnings + errors only. The verbose log is written while
222+
// the target (and its GPU) are frozen, so keep it minimal.
223+
static const char *kCriuVerbosity = "-v1";
233224

234225
int run_criu_dump(pid_t pid, const std::string &images_dir,
235226
const std::string &log_file) {
@@ -273,8 +264,7 @@ int run_criu_dump(pid_t pid, const std::string &images_dir,
273264
close(status_pipe[1]);
274265
signal(SIGCHLD, SIG_DFL);
275266
std::string pid_arg = std::to_string(static_cast<long long>(pid));
276-
std::string vflag = criu_verbosity_flag();
277-
execlp("criu", "criu", "dump", "--unprivileged", vflag.c_str(), "--tree",
267+
execlp("criu", "criu", "dump", "--unprivileged", kCriuVerbosity, "--tree",
278268
pid_arg.c_str(), "--images-dir", images_dir.c_str(),
279269
"--leave-running", "--shell-job", "--tcp-close",
280270
"--file-locks", "--log-file", log_file.c_str(),
@@ -343,8 +333,7 @@ int run_criu_restore(const std::string &images_dir, const std::string &log_file,
343333
}
344334
if (child == 0) {
345335
signal(SIGCHLD, SIG_DFL);
346-
std::string vflag = criu_verbosity_flag();
347-
execlp("criu", "criu", "restore", "--unprivileged", vflag.c_str(),
336+
execlp("criu", "criu", "restore", "--unprivileged", kCriuVerbosity,
348337
"--images-dir", images_dir.c_str(), "--restore-detached",
349338
"--shell-job", "--tcp-close", "--file-locks", "--inherit-fd",
350339
inherit_arg.c_str(), "--log-file", log_file.c_str(),

snapshot_client.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,8 @@ CUresult write_snapshot_id(conn_t *conn, const char *id) {
2929
}
3030

3131
std::string configured_snapshot_id() {
32-
{
33-
std::lock_guard<std::mutex> lock(g_snapshot_id_mutex);
34-
if (g_snapshot_id[0] != '\0') {
35-
return std::string(g_snapshot_id);
36-
}
37-
}
38-
const char *env_id = getenv("LUPINE_SNAPSHOT_ID");
39-
return env_id != nullptr ? std::string(env_id) : std::string();
32+
std::lock_guard<std::mutex> lock(g_snapshot_id_mutex);
33+
return std::string(g_snapshot_id);
4034
}
4135

4236
int send_all(lupine_socket_t connfd, const void *data, size_t size) {

0 commit comments

Comments
 (0)