From 587989b4e013f1a251650b348efd758ca966cad7 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 25 Oct 2021 18:30:05 -0500 Subject: [PATCH] EX-4075 lipe: replace llapi_error() Replace remaining uses of llapi_error(), llapir_err_noerrno() with LX_ERROR() etc. Test-Parameters: trivial testlist=hot-pools Signed-off-by: John L. Hammond Change-Id: Ia879782658aab8658b8e738649188ee102c18610 Reviewed-on: https://review.whamcloud.com/45361 Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Tested-by: jenkins Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-on: https://review.whamcloud.com/46100 --- lipe/src/lamigo.c | 109 +++++++++++++++++++++++----------------------- lipe/src/lamigo_alr.c | 35 +++++++-------- lipe/src/lipe_ssh.c | 31 +++++-------- lipe/src/lpurge.c | 75 +++++++++++-------------------- lustre/tests/hot-pools.sh | 2 +- 5 files changed, 108 insertions(+), 144 deletions(-) diff --git a/lipe/src/lamigo.c b/lipe/src/lamigo.c index ae6a41e..9247be0 100644 --- a/lipe/src/lamigo.c +++ b/lipe/src/lamigo.c @@ -451,7 +451,7 @@ static void lamigo_dump_stats_file(void) return; f = fopen(opt.o_dump_file, "w"); if (!f) { - llapi_error(LLAPI_MSG_ERROR, errno, "can't open dump file"); + LX_ERROR("cannot open '%s': %s\n", opt.o_dump_file, strerror(errno)); return; } fprintf(f, @@ -706,6 +706,8 @@ static int lamigo_spawn_replication(struct resync_job *rj) pthread_t pid; int resync = rj->rj_resync; + assert(rj->rj_pid == 0); + /* choose the agent - for simplicity just one with minimal jobs */ /* XXX: to support many agents it makes sense to introduce additional * structure like a sorted list or something similar @@ -725,24 +727,26 @@ static int lamigo_spawn_replication(struct resync_job *rj) } if (!a) { LX_DEBUG("no good agent\n"); - return -EBUSY; + rc = -EBUSY; + goto out; } rj->rj_agent = a; rj->rj_start = time(NULL); - LX_DEBUG("new job %s for "DFID" spawned on %s\n", + LX_DEBUG("spawning new %s job for "DFID" on %s\n", resync == AMIGO_RESYNC_EXTEND ? "extend" : "resync", PFID(&rj->rj_fid), rj->rj_agent->rag_hostname); - rc = pthread_create(&pid, NULL, lamigo_replicate_one, rj); - if (rc == 0) { - rj->rj_pid = pid; - a->rag_jobs++; - stats.s_spawned++; - } else { - rj->rj_pid = 0; - } + /* pthread_*() returns a positve error number on error. */ + rc = -pthread_create(&pid, NULL, lamigo_replicate_one, rj); + if (rc < 0) + goto out; + rj->rj_pid = pid; + a->rag_jobs++; + stats.s_spawned++; + rc = 0; +out: return rc; } @@ -938,7 +942,7 @@ static int lamigo_striping_is_in_sync(struct lov_user_md *lum, } if (opt.o_src_dom && v3->lmm_pattern == LOV_PATTERN_MDT) { - LX_DEBUG("DoM component"); + LX_DEBUG("DoM component\n"); onsrc++; continue; } @@ -1089,8 +1093,8 @@ static int lamigo_get_attrs(const struct lu_fid *fid, rc = ioctl(open_by_fid_fd, IOC_MDC_GETFILEINFO_V1, lamigo_lmd_buf); if (rc) { if (errno != ENOENT) - llapi_error(LLAPI_MSG_ERROR, errno, - "cannot get striping for "DFID, PFID(fid)); + LX_ERROR("cannot get striping for "DFID": %s\n", PFID(fid), strerror(errno)); + return errno; } lmdp = (struct lov_user_mds_data_v1 *)lamigo_lmd_buf; @@ -1119,7 +1123,7 @@ static int lamigo_get_attrs(const struct lu_fid *fid, snprintf(fidstr, sizeof(fidstr), DFID, PFID(fid)); fd = openat(open_by_fid_fd, fidstr, O_RDONLY); if (fd < 0) { - llapi_error(LLAPI_MSG_ERROR, errno, "can't open file"); + LX_ERROR("cannot open '%s': %s\n", fidstr, strerror(errno)); goto out; } @@ -1262,9 +1266,9 @@ static void lamigo_check_bad_agents(void) continue; /* submit an empty job to check whether the agent is back */ - rc = pthread_create(&pid, NULL, lamigo_check_agent_func, - (void *)a); - if (rc) + rc = -pthread_create(&pid, NULL, lamigo_check_agent_func, + (void *)a); + if (rc < 0) return; rj = xcalloc(1, sizeof(*rj)); rj->rj_check_job = 1; @@ -1289,7 +1293,7 @@ static int lamigo_submit_job(struct resync_job *rj) rc = lamigo_spawn_replication(rj); if (rc < 0) { - llapi_error(LLAPI_MSG_ERROR, errno, "can't create a job"); + LX_ERROR("cannot spawn a new job: %s\n", strerror(-rc)); lipe_list_add_tail(&rj->rj_list, &lamigo_failed_job_list); return 1; } @@ -1530,8 +1534,8 @@ static unsigned long get_fid_cache_size(int pct) int rc; rc = sysinfo(&sinfo); - if (rc) { - llapi_error(LLAPI_MSG_ERROR, rc, "failed to get sysinfo"); + if (rc < 0) { + LX_ERROR("cannot get sysinfo: %s\n", strerror(errno)); /* ignore this error, just pick some reasonable static * limit for the cache size (e.g. 256MB, default value). */ @@ -1594,9 +1598,8 @@ static void lamigo_check_and_clear_changelog(void) lamigo_last_cleared_index = index; rc = llapi_changelog_clear(opt.o_mdtname, lamigo_changelog_user, index); if (rc < 0) { - llapi_error(LLAPI_MSG_ERROR, rc, - "failed to clear changelog record %s:%llu (%llu last)", - lamigo_changelog_user, index, lamigo_last_cleared_index); + LX_ERROR("cannot clear changelog record %s:%llu: %s\n", + lamigo_changelog_user, index, strerror(errno)); systemf("lctl get_param 'mdd.%s.changelog_users'", opt.o_mdtname); } } @@ -1684,8 +1687,8 @@ static void lamigo_check_jobs(void) if (rc == EBUSY) { continue; } else if (rc != 0) { - llapi_error(LLAPI_MSG_ERROR, rc, "cannot join thread %lld", - (long long)rj->rj_pid); + LX_ERROR("cannot join thread %lld: %s\n", + (long long)rj->rj_pid, strerror(rc)); } else { lipe_list_del(&rj->rj_list); lamigo_job_fini(rj, retval); @@ -2272,12 +2275,11 @@ static void load_config(char *name) } if (strcmp(t, "mountpoint") == 0) - llapi_err_noerrno(LLAPI_MSG_WARN, - "'mountpoint' is deprecated, use 'mount' instead"); + LX_WARN("'mountpoint' is deprecated, use 'mount' instead\n"); opt = lamigo_keyword_lookup(t); if (!opt) { - llapi_err_noerrno(LLAPI_MSG_ERROR, "unknown tunable: %s", t); + LX_ERROR("unknown tunable: %s\n", t); continue; } @@ -2318,8 +2320,7 @@ void lamigo_parse_opts(int argc, char **argv) exit(EXIT_FAILURE + 1); } if (strcmp(options[opt_index].name, "mountpoint") == 0) - llapi_err_noerrno(LLAPI_MSG_WARN, - "'mountpoint' is deprecated, use 'mount' instead"); + LX_WARN("'mountpoint' is deprecated, use 'mount' instead\n"); lamigo_process_opt(c, optarg); } @@ -2470,8 +2471,9 @@ int lamigo_lipe_callback(struct lipe_instance *instance, attrs, true /* need_fid */, false /* quit_on_error */); - if (rc) { - llapi_error(LLAPI_MSG_ERROR, rc, "can't get attrs"); + if (rc < 0) { + LX_ERROR("cannot get attrs for "DFID": %s\n", + PFID(&attrs->loa_fid), strerror(-rc)); return 0; } @@ -2514,9 +2516,8 @@ static int lamigo_find_device(const char *devname) rc = cfs_get_param_paths(&paths, "osd-*/%s/fstype", devname); if (rc != 0) { - llapi_error(LLAPI_MSG_ERROR, errno, - "can't find device '%s'", devname); - return rc; + LX_ERROR("cannot find device '%s': %s\n", devname, strerror(errno)); + return -errno; } for (i = 0; i < paths.gl_pathc; i++) { struct stat st; @@ -2528,11 +2529,12 @@ static int lamigo_find_device(const char *devname) mdtprefix = strdup(paths.gl_pathv[i]); break; } + if (!mdtprefix) { - llapi_err_noerrno(LLAPI_MSG_ERROR, - "Can't find device '%s'", devname); - return -1; + LX_ERROR("cannot find MDT device '%s'\n", devname); + return -ENOENT; } + i = strlen(mdtprefix); while (i && mdtprefix[i] != '/') i--; @@ -2550,14 +2552,14 @@ static int lamigo_read_file(const char *param, char *val, const int vallen) fd = open(param, O_RDONLY); if (fd < 0) { - llapi_error(LLAPI_MSG_ERROR, errno, "cannot open '%s'", param); + LX_ERROR("cannot open '%s': %s\n", param, strerror(errno)); rc = -errno; goto out; } rc = read(fd, val, vallen); if (rc < 0) { - llapi_error(LLAPI_MSG_ERROR, errno, "cannot read '%s'", param); + LX_ERROR("cannot read '%s': %s\n", param, strerror(errno)); rc = -errno; goto out; } @@ -2595,14 +2597,14 @@ int lamigo_rescan(void) rc = lamigo_find_device(opt.o_mdtname); if (rc) { - llapi_err_noerrno(LLAPI_MSG_ERROR, "failed to find device '%s'", - opt.o_mdtname); + LX_ERROR("cannot find MDT device '%s': %s\n", + opt.o_mdtname, strerror(-rc)); return rc; } rc = lamigo_read_param("fstype", buf, sizeof(buf)); if (rc) { - llapi_err_noerrno(LLAPI_MSG_ERROR, "failed to read param fstype"); + LX_ERROR("cannot read 'fstype' param for '%s': %s\n", opt.o_mdtname, strerror(-rc)); return rc; } @@ -2611,13 +2613,13 @@ int lamigo_rescan(void) else if (!strcmp(buf, "zfs")) { instance.li_expected_fstype = LBT_LUSTRE_ON_ZFS; } else { - llapi_err_noerrno(LLAPI_MSG_ERROR, "unknown fstype %s", buf); + LX_ERROR("device '%s' has unknown fstype '%s'\n", opt.o_mdtname, buf); return -EINVAL; } rc = lamigo_read_param("mntdev", mdt_mntdev, sizeof(buf)); if (rc) { - llapi_err_noerrno(LLAPI_MSG_ERROR, "failed to read param mntdev"); + LX_ERROR("cannot read 'mntdev' param for device '%s': %s\n", opt.o_mdtname, strerror(-rc)); return rc; } strcpy(instance.li_device, mdt_mntdev); @@ -2643,8 +2645,7 @@ int lamigo_rescan(void) true /* abort_failure */, &ldd_err); if (rc) { - llapi_err_noerrno(LLAPI_MSG_ERROR, "failed to scan %s", - instance.li_device); + LX_ERROR("cannot scan '%s': %s\n", instance.li_device, strerror(-rc)); return rc; } @@ -2674,17 +2675,15 @@ static void lamigo_changelog_mask_set(void) globfree(&paths); if (rc < 0) { - llapi_error(LLAPI_MSG_WARN, rc, "can't open %s, assume OK", - paths.gl_pathv[0]); + LX_WARN("cannot read '%s': %s\n", paths.gl_pathv[0], strerror(-rc)); return; } + if (rc >= 0 && strstr(buf, "CLOSE") && strstr(buf, "UNLNK")) { /* the mask is good enough */ return; } - llapi_err_noerrno(LLAPI_MSG_INFO, "set changelog mask"); - snprintf(buf, sizeof(buf), "lctl set_param -n mdd.%s.changelog_mask=+\"CLOSE UNLNK\"", opt.o_mdtname); @@ -2692,7 +2691,7 @@ static void lamigo_changelog_mask_set(void) if (rc < 0) LX_FATAL("cannot enable CLOSE/UNLNK in changelog: rc = %d\n", rc); - llapi_err_noerrno(LLAPI_MSG_INFO, "enable CLOSE/UNLNK in changelog"); + LX_INFO("added 'CLOSE UNLNK' to changelog mask for '%s'\n", opt.o_mdtname); } /* @@ -3257,8 +3256,8 @@ static int lamigo_check_hot_one(struct alr_heat *ht) struct mirror_opts mo = { 0 }; int sync; - LX_DEBUG("check hot "DFID": H: %Lu/%Lu, P: %Lu/%Lu, " - "L %d, I %d %s\n", PFID(&ht->ah_fid), + LX_DEBUG("check hot "DFID": H: %Lu/%Lu, P: %Lu/%Lu, L %d, I %d %s\n", + PFID(&ht->ah_fid), ht->ah_heat[0], ht->ah_heat[1], ht->ah_pools[0], ht->ah_pools[1], ht->ah_livetime, ht->ah_idle, ht->ah_mark ? "M" : ""); diff --git a/lipe/src/lamigo_alr.c b/lipe/src/lamigo_alr.c index 0cf3df4..10ab2e1 100644 --- a/lipe/src/lamigo_alr.c +++ b/lipe/src/lamigo_alr.c @@ -174,8 +174,7 @@ void lamigo_alr_parse_one(const char *line) "g=%llu n=%llu d=%c\n", ostname, RFID(&fid), ×tamp, &begin, &end, &iosize, &segments, &count, &rw); if (rc != 11) { - llapi_err_noerrno(LLAPI_MSG_ERROR, - "cannot parse access line: %s (%d)\n", line, rc); + LX_ERROR("cannot parse access log line: '%s' (%d)\n", line, rc); return; } /* f_ver contains compid, we track files */ @@ -184,14 +183,12 @@ void lamigo_alr_parse_one(const char *line) /* attribute IO to hot or cold pool */ ostidx = strstr(ostname, "-OST"); if (!ostidx) { - llapi_err_noerrno(LLAPI_MSG_ERROR, - "cannot parse OST name: %s\n", ostname); + LX_ERROR("cannot parse access log OST name '%s'\n", ostname); return; } idx = strtol(ostidx + 4, &strend, 16); if (*strend != '\0') { - llapi_err_noerrno(LLAPI_MSG_ERROR, - "cannot parse OST idx: %s\n", ostidx); + LX_ERROR("cannot parse access log OST index '%s'\n", ostidx); return; } /* src_pools - "hot" pools @@ -263,14 +260,12 @@ static int lamigo_alr_agent_run(struct alr_agent *ala) rc = lipe_ssh_start_cmd(&ala->ala_ctx, cmd, &channel); if (rc != SSH_OK) { - llapi_error(LLAPI_MSG_ERROR|LLAPI_MSG_NO_ERRNO, 0, - "cannot start ofd_access_log_reader on host '%s': rc = %d\n", - ala->ala_host, rc); + LX_ERROR("cannot start ofd_access_log_reader on host '%s': rc = %d\n", + ala->ala_host, rc); goto out; } - llapi_err_noerrno(LLAPI_MSG_DEBUG, "alr agent on %s is running\n", - ala->ala_host); + LX_DEBUG("started access log reader agent on '%s'\n", ala->ala_host); while (ssh_channel_is_open(channel) && !ssh_channel_is_eof(channel)) { rc = ssh_channel_read(channel, buffer + offset, @@ -280,17 +275,19 @@ static int lamigo_alr_agent_run(struct alr_agent *ala) offset = lamigo_alr_parse(buffer, offset + rc, &received); now = time(NULL); if (now - last_checked > opt.o_progress_interval) { - llapi_err_noerrno(LLAPI_MSG_DEBUG, "%d recoreds from %s\n", - received, ala->ala_host); + LX_DEBUG("received %d access log records from host '%s'\n", + received, ala->ala_host); received = 0; last_checked = now; } } rc = ssh_channel_get_exit_status(channel); - llapi_err_noerrno(rc == 0 ? LLAPI_MSG_DEBUG : LLAPI_MSG_ERROR, - "alr agent on %s exited with status %d\n", - ala->ala_host, rc); + if (rc == 0) + LX_DEBUG("access log reader on '%s' exited with status 0\n", ala->ala_host); + else + LX_ERROR("access log reader on '%s' terminated with status %d\n", ala->ala_host, rc); + out: if (channel != NULL) { ssh_channel_send_eof(channel); @@ -739,9 +736,9 @@ int lamigo_alr_check_is_hot(struct lu_fid *fid, struct alr_heat *ah) lamigo_alr_fill_ht(ah, f); fid_hash_unlock(&alr_head.alh_hash, fh); - llapi_err_noerrno(LLAPI_MSG_DEBUG, "ALR: "DFID" heat: %d/%d, idle %d, live %d\n", - PFID(fid), (int)ah->ah_heat[0], (int)ah->ah_heat[1], - (int)ah->ah_idle, (int)ah->ah_livetime); + LX_DEBUG("ALR: "DFID" heat: %d/%d, idle %d, live %d\n", + PFID(fid), (int)ah->ah_heat[0], (int)ah->ah_heat[1], + (int)ah->ah_idle, (int)ah->ah_livetime); return 1; } diff --git a/lipe/src/lipe_ssh.c b/lipe/src/lipe_ssh.c index 1bf8ab2..01d537f 100644 --- a/lipe/src/lipe_ssh.c +++ b/lipe/src/lipe_ssh.c @@ -3,19 +3,12 @@ #include #include #include - #include - +#include "lx_log.h" #include "lipe_ssh.h" int lipe_ssh_log_verbosity; -#define lipe_ssh_debug(fmt, args...) \ - llapi_error(LLAPI_MSG_DEBUG|LLAPI_MSG_NO_ERRNO, 0, fmt, ##args) - -#define lipe_ssh_error(fmt, args...) \ - llapi_error(LLAPI_MSG_ERROR|LLAPI_MSG_NO_ERRNO, 0, fmt, ##args) - static int lipe_ssh_session_start_cmd(ssh_session session, const char *cmd, ssh_channel *pchannel) { ssh_channel channel = NULL; @@ -30,7 +23,7 @@ static int lipe_ssh_session_start_cmd(ssh_session session, const char *cmd, ssh_ channel = ssh_channel_new(session); if (channel == NULL) { - lipe_ssh_error("canot create a new SSH channel: %s", + LX_ERROR("cannot create a new SSH channel: %s\n", ssh_get_error(session)); rc = SSH_ERROR; goto out; @@ -38,14 +31,14 @@ static int lipe_ssh_session_start_cmd(ssh_session session, const char *cmd, ssh_ rc = ssh_channel_open_session(channel); if (rc != SSH_OK) { - lipe_ssh_error("cannot open SSH session channel: %s", + LX_ERROR("cannot open SSH session channel: %s\n", ssh_get_error(session)); goto out; } rc = ssh_channel_request_exec(channel, cmd); if (rc != SSH_OK) { - lipe_ssh_error("cannot execute SSH command: %s", + LX_ERROR("cannot execute SSH command: %s\n", ssh_get_error(session)); goto out; } @@ -113,11 +106,11 @@ static int lipe_ssh_session_create(ssh_session *psession, const char *host) assert(*psession == NULL); assert(host != NULL); - lipe_ssh_debug("creating new SSH session for host '%s'", host); + LX_DEBUG("creating new SSH session for host '%s'\n", host); session = ssh_new(); if (session == NULL) { - lipe_ssh_error("cannot create a new SSH session: %s", + LX_ERROR("cannot create a new SSH session: %s\n", strerror(ENOMEM)); /* Probably. */ rc = SSH_ERROR; goto out; @@ -130,14 +123,14 @@ static int lipe_ssh_session_create(ssh_session *psession, const char *host) rc = ssh_options_set(session, SSH_OPTIONS_HOST, host); if (rc != SSH_OK) { - lipe_ssh_error("cannot set SSH session host to '%s: %s'", + LX_ERROR("cannot set SSH session host to '%s': %s\n", host, ssh_get_error(session)); goto out; } rc = ssh_options_set(session, SSH_OPTIONS_TIMEOUT, &timeout); if (rc != SSH_OK) { - lipe_ssh_error("cannot set SSH timeout to %ld: %s", + LX_ERROR("cannot set SSH timeout to %ld: %s\n", timeout, ssh_get_error(session)); goto out; } @@ -145,7 +138,7 @@ static int lipe_ssh_session_create(ssh_session *psession, const char *host) /* Connect to the ssh server */ rc = ssh_connect(session); if (rc != SSH_OK) { - lipe_ssh_error("cannot connect SSH session to host '%s': %s", + LX_ERROR("cannot connect SSH session to host '%s': %s\n", host, ssh_get_error(session)); goto out; } @@ -153,16 +146,16 @@ static int lipe_ssh_session_create(ssh_session *psession, const char *host) /* Automatically authenticate with public key */ rc = ssh_userauth_publickey_auto(session, NULL, NULL); if (rc != SSH_AUTH_SUCCESS) { - lipe_ssh_error("cannot authenticate SSH session to host '%s': %s", + LX_ERROR("cannot authenticate SSH session to host '%s': %s\n", host, ssh_get_error(session)); goto out; } + LX_DEBUG("created new SSH session for host '%s'\n", host); *psession = session; session = NULL; rc = SSH_OK; out: - lipe_ssh_debug("create new SSH session for host '%s': rc = %d", host, rc); lipe_ssh_session_destroy(&session); assert(rc <= 0); @@ -180,7 +173,7 @@ static int lipe_ssh_context_check(struct lipe_ssh_context *ctx) static void lipe_ssh_context_fail(struct lipe_ssh_context *ctx) { - lipe_ssh_debug("fail SSH context for host '%s'\n", ctx->lsc_host); + LX_DEBUG("failing SSH context for host '%s'\n", ctx->lsc_host); lipe_ssh_session_destroy(&ctx->lsc_session); } diff --git a/lipe/src/lpurge.c b/lipe/src/lpurge.c index fc2bb2d..6403e4f 100644 --- a/lipe/src/lpurge.c +++ b/lipe/src/lpurge.c @@ -1341,11 +1341,8 @@ void parse_mountpoint(const char *name) LX_FATAL("'%s' isn't Lustre mountpoint: %d\n", name, rc); open_by_fid_fd = openat(lustre_fd, ".lustre/fid", O_RDONLY); - if (open_by_fid_fd < 0) { - llapi_error(LLAPI_MSG_FATAL, -errno, - "cannot open '%s/.lustre/fid'", name); - exit(1); - } + if (open_by_fid_fd < 0) + LX_FATAL("cannot open '%s/.lustre/fid': %s\n", name, strerror(errno)); } #define LPURGE_INTERNAL_DUMP_FIDS 1 @@ -1409,12 +1406,9 @@ void lpurge_process_opt(int c, char *optarg) break; case 'h': value = strtol(optarg, &endptr, 10); - if (*endptr != '\0' || value < 0) { - llapi_error(LLAPI_MSG_FATAL, -EINVAL, - "invalid high watermark: '%s'\n", - optarg); - exit(1); - } + if (*endptr != '\0' || value < 0) + LX_FATAL("invalid high watermark: '%s'\n", optarg); + opt.o_freehi = value; break; case 'H': @@ -1422,32 +1416,23 @@ void lpurge_process_opt(int c, char *optarg) break; case 'i': value = strtol(optarg, &endptr, 10); - if (*endptr != '\0' || value < 0) { - llapi_error(LLAPI_MSG_FATAL, -EINVAL, - "invalid check interval: '%s'\n", - optarg); - exit(1); - } + if (*endptr != '\0' || value < 0) + LX_FATAL("invalid check interval: '%s'\n", optarg); + opt.o_interval = value; break; case 'j': value = strtol(optarg, &endptr, 10); - if (*endptr != '\0' || value < 0) { - llapi_error(LLAPI_MSG_FATAL, -EINVAL, - "invalid max jobs: '%s'\n", - optarg); - exit(1); - } + if (*endptr != '\0' || value < 0) + LX_FATAL("invalid max jobs: '%s'\n", optarg); + opt.o_max_jobs = value; break; case 'l': value = strtol(optarg, &endptr, 10); - if (*endptr != '\0' || value < 0) { - llapi_error(LLAPI_MSG_FATAL, -EINVAL, - "invalid low watermark: '%s'\n", - optarg); - exit(1); - } + if (*endptr != '\0' || value < 0) + LX_FATAL("invalid low watermark: '%s'\n", optarg); + opt.o_freelo = value; break; case 'm': @@ -1465,32 +1450,23 @@ void lpurge_process_opt(int c, char *optarg) break; case 'R': value = strtol(optarg, &endptr, 10); - if (*endptr != '\0' || value < 0) { - llapi_error(LLAPI_MSG_FATAL, -EINVAL, - "invalid scan rate: '%s'\n", - optarg); - exit(1); - } + if (*endptr != '\0' || value < 0) + LX_FATAL("invalid scan rate: '%s'\n", optarg); + opt.o_scan_rate = value; break; case 'S': value = strtol(optarg, &endptr, 10); - if (*endptr != '\0' || value < 0) { - llapi_error(LLAPI_MSG_FATAL, -EINVAL, - "invalid slot size: '%s'\n", - optarg); - exit(1); - } + if (*endptr != '\0' || value < 0) + LX_FATAL("invalid slot size: '%s'\n", optarg); + opt.o_slot_size = value; break; case 't': value = strtol(optarg, &endptr, 10); - if (*endptr != '\0' || value < 0) { - llapi_error(LLAPI_MSG_FATAL, -EINVAL, - "invalid scan threads count: '%s'\n", - optarg); - exit(1); - } + if (*endptr != '\0' || value < 0) + LX_FATAL("invalid scan threads count: '%s'\n", optarg); + opt.o_scan_threads = value; break; case 'w': @@ -1965,9 +1941,8 @@ int main(int argc, char **argv) * followed by the OST name ("lpurge lustre-OST0000"). */ llapi_set_command_name(ostname); - llapi_error(LLAPI_MSG_INFO|LLAPI_MSG_NO_ERRNO, 0, - "version %s-%s, revision %s\n", - PACKAGE_VERSION, LIPE_RELEASE, LIPE_REVISION); + LX_INFO("version %s-%s, revision %s\n", + PACKAGE_VERSION, LIPE_RELEASE, LIPE_REVISION); lpurge_get_ost_mntpt(); lpurge_configure_thresholds(); diff --git a/lustre/tests/hot-pools.sh b/lustre/tests/hot-pools.sh index 3283823..ebf4fea 100755 --- a/lustre/tests/hot-pools.sh +++ b/lustre/tests/hot-pools.sh @@ -1243,7 +1243,7 @@ test_8() { sleep $LAMIGO_AGE do_facet $facet "cat $log_file" | - grep -q 'new job extend' || + grep -q 'spawning new extend job for' || error "no debug messages with -b option" } run_test 8 "lamigo: start with debug (-b) command line option" -- 1.8.3.1