X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fload.c;h=347e4ca08896b8507a9e0939c281a0046a946bec;hp=4d38c792b82cc4e9ffe69253b04457410906eb9a;hb=c7e35b037773dbbfe10178c946ba44feefb226e1;hpb=1114378362fe014288ccaab1d1fed52f7b5703f8 diff --git a/src/bin/lttng/commands/load.c b/src/bin/lttng/commands/load.c index 4d38c792b..347e4ca08 100644 --- a/src/bin/lttng/commands/load.c +++ b/src/bin/lttng/commands/load.c @@ -55,10 +55,14 @@ static void usage(FILE *ofp) fprintf(ofp, "usage: lttng load [OPTIONS] [SESSION]\n"); fprintf(ofp, "\n"); fprintf(ofp, "Options:\n"); - fprintf(ofp, " -h, --help Show this help\n"); - fprintf(ofp, " -a, --all Load all sessions (default)\n"); - fprintf(ofp, " -i, --input-path Input path of the session configuration(s)\n"); - fprintf(ofp, " -f, --force Override existing session configuration(s)\n"); + fprintf(ofp, " -h, --help Show this help\n"); + fprintf(ofp, " -a, --all Load all sessions (default)\n"); + fprintf(ofp, " -i, --input-path PATH Input path of the session file(s).\n"); + fprintf(ofp, " If a directory, load all files in it\n"); + fprintf(ofp, " else try to load the given file.\n"); + fprintf(ofp, " -f, --force Override existing session(s).\n"); + fprintf(ofp, " This will destroy existing session(s)\n"); + fprintf(ofp, " before creating new one(s).\n"); } /* @@ -73,6 +77,13 @@ int cmd_load(int argc, const char **argv) pc = poptGetContext(NULL, argc, argv, load_opts, 0); poptReadDefaultConfig(pc, 0); + /* TODO: mi support */ + if (lttng_opt_mi) { + ret = -LTTNG_ERR_MI_NOT_IMPLEMENTED; + ERR("mi option not supported"); + goto end; + } + while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case OPT_HELP: @@ -93,18 +104,27 @@ int cmd_load(int argc, const char **argv) if (!opt_load_all) { session_name = poptGetArg(pc); - if (!session_name) { - ERR("A session name must be provided if the \"all\" option is not used."); - ret = CMD_ERROR; - goto end; + if (session_name) { + DBG2("Loading session name: %s", session_name); } - DBG2("Loading session name: %s", session_name); } - ret = config_load_session(opt_input_path, session_name, opt_force); + ret = config_load_session(opt_input_path, session_name, opt_force, 0); if (ret) { ERR("%s", lttng_strerror(ret)); ret = -ret; + } else { + if (opt_load_all) { + MSG("All sessions have been loaded successfully"); + } else if (session_name) { + ret = config_init((char *)session_name); + if (ret < 0) { + ret = CMD_WARNING; + } + MSG("Session %s has been loaded successfully", session_name); + } else { + MSG("Session has been loaded successfully"); + } } end: poptFreeContext(pc);