From: Alex Zhuravlev Date: Fri, 6 Aug 2021 05:59:51 +0000 (+0300) Subject: EX-3612 lamigo: use system(2) instead of libssh for local agents X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=564eb59e9ba3d549c1790f7c80167c2c8f37336f;p=fs%2Flustre-release.git EX-3612 lamigo: use system(2) instead of libssh for local agents In lamigo, interpret an agent host of '-' to mean the localhost using system(2) instead of libssh. Signed-off-by: Alex Zhuravlev Change-Id: I1211f2e43af06659c660fdd57496d09c5d5413fa Reviewed-on: https://review.whamcloud.com/46902 Tested-by: jenkins Reviewed-by: John L. Hammond Tested-by: Maloo --- diff --git a/lipe/src/lamigo.c b/lipe/src/lamigo.c index 6258766..60696c8 100644 --- a/lipe/src/lamigo.c +++ b/lipe/src/lamigo.c @@ -184,6 +184,7 @@ struct resync_agent { int rag_maxjobs; int rag_jobs; bool rag_bad; + bool rag_is_local; int rag_check_in_progress; struct lipe_list_head rag_list; struct lipe_list_head rag_ssh_list; @@ -652,7 +653,14 @@ static int lamigo_exec_cmd(struct resync_agent *a, const char *cmd, int *pstatus lipe_list_del(&rss->rss_list); pthread_mutex_unlock(&a->rag_ssh_lock); - rc = lipe_ssh_exec(&rss->rss_ctx, cmd, pstatus); + rc = a->rag_is_local ? + system(cmd) : + lipe_ssh_exec(&rss->rss_ctx, cmd, pstatus); + if (rc) + llapi_error(LLAPI_MSG_INFO, rc, + "error executing ssh command '%s' on '%s'", + cmd, a->rag_hostname); + pthread_mutex_lock(&a->rag_ssh_lock); lipe_list_add(&rss->rss_list, &a->rag_ssh_list); pthread_cond_signal(&a->rag_ssh_cond); @@ -1714,8 +1722,16 @@ static void lamigo_add_agent(const char *host, const char *mnt, char *jobs) a = xcalloc(1, sizeof(*a)); a->rag_index = lamigo_agent_count; - a->rag_hostname = xstrdup(host); + + if (strcmp(host, "-") == 0) { + a->rag_hostname = xstrdup("localhost"); + a->rag_is_local = 1; + } else { + a->rag_hostname = xstrdup(host); + } + a->rag_mountpoint = xstrdup(mnt); + if (jobs) { char *endptr; diff --git a/lustre/tests/hot-pools.sh b/lustre/tests/hot-pools.sh index caf4194..ee36fe4 100755 --- a/lustre/tests/hot-pools.sh +++ b/lustre/tests/hot-pools.sh @@ -104,7 +104,7 @@ create_ost_pools() { pool_add_targets $LAMIGO_TGT $((OSTCOUNT / 2)) $((OSTCOUNT - 1)) || error "failed to add targets to OST pool '$LAMIGO_TGT'" - LAMIGO_AGT_NODES="$(osts_nodes_in_pool $LAMIGO_SRC)" + LAMIGO_AGT_NODES="${LAMIGO_AGT_NODES:-$(osts_nodes_in_pool $LAMIGO_SRC)}" } # initialize lamigo variables