load: introduce --override-name
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 7 Oct 2016 16:03:34 +0000 (12:03 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 7 Oct 2016 19:44:10 +0000 (15:44 -0400)
The --override-name option allow users to override the name of the
session to be loaded using the command-line.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
doc/man/lttng-load.1.txt
src/bin/lttng/commands/load.c

index 6c565329bdaf763dd5773c5ba222a1c43f574612..10f893e5370daf0b0623584258053ea241d89672 100644 (file)
@@ -11,7 +11,7 @@ SYNOPSIS
 --------
 [verse]
 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *load* [option:--force] [option:--input-path='PATH']
 --------
 [verse]
 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *load* [option:--force] [option:--input-path='PATH']
-      [option:--override-url='URL'] ['SESSION']
+      [option:--override-url='URL'] [option:--override-name='NAME'] ['SESSION']
 
 
 DESCRIPTION
 
 
 DESCRIPTION
@@ -63,6 +63,10 @@ option:--override-url::
     dependant on the type of session(s) to be loaded. Refer to (1)lttng-create for
     the accepted URL format.
 
     dependant on the type of session(s) to be loaded. Refer to (1)lttng-create for
     the accepted URL format.
 
+option:--override-name::
+    Set the session name to NAME. This option is invalid in combination with
+    the --all option.
+
 By default, existing tracing sessions are not overwritten when loading:
 the command fails. The option:--force option can be used to allow this.
 
 By default, existing tracing sessions are not overwritten when loading:
 the command fails. The option:--force option can be used to allow this.
 
index 8fa718ed522fced8bdb942c92f26be0f6b366360..630dccd3b5787e223bdca393a3f3e0e7d28e4579 100644 (file)
@@ -31,6 +31,7 @@
 
 static char *opt_input_path;
 static char *opt_override_url;
 
 static char *opt_input_path;
 static char *opt_override_url;
+static char *opt_override_session_name;
 static int opt_force;
 static int opt_load_all;
 
 static int opt_force;
 static int opt_load_all;
 
@@ -47,12 +48,13 @@ static struct mi_writer *writer;
 
 static struct poptOption load_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
 
 static struct poptOption load_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",        'h',  POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"all",         'a',  POPT_ARG_NONE, 0, OPT_ALL, 0, 0},
-       {"input-path",  'i',  POPT_ARG_STRING, &opt_input_path, 0, 0, 0},
-       {"force",       'f',  POPT_ARG_NONE, 0, OPT_FORCE, 0, 0},
-       {"override-url",'U',  POPT_ARG_STRING, &opt_override_url, 0, 0, 0},
-       {"list-options",  0,  POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
+       {"help",          'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
+       {"all",           'a', POPT_ARG_NONE, 0, OPT_ALL, 0, 0},
+       {"input-path",    'i', POPT_ARG_STRING, &opt_input_path, 0, 0, 0},
+       {"force",         'f', POPT_ARG_NONE, 0, OPT_FORCE, 0, 0},
+       {"override-url",    0, POPT_ARG_STRING, &opt_override_url, 0, 0, 0},
+       {"override-name",   0, POPT_ARG_STRING, &opt_override_session_name, 0, 0, 0},
+       {"list-options",    0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
        {0, 0, 0, 0, 0, 0, 0}
 };
 
        {0, 0, 0, 0, 0, 0, 0}
 };
 
@@ -258,6 +260,21 @@ int cmd_load(int argc, const char **argv)
                }
        }
 
                }
        }
 
+       if (opt_override_session_name) {
+               if (opt_load_all) {
+                       ERR("Options --all and --override-name cannot be used simultaneously");
+                       ret = CMD_ERROR;
+                       goto end;
+               }
+               ret = lttng_load_session_attr_set_override_session_name(session_attr,
+                               opt_override_session_name);
+               if (ret) {
+                       ERR("Failed to set session name override");
+                       ret = CMD_ERROR;
+                       goto end;
+               }
+       }
+
        ret = lttng_load_session(session_attr);
        if (ret) {
                ERR("%s", lttng_strerror(ret));
        ret = lttng_load_session(session_attr);
        if (ret) {
                ERR("%s", lttng_strerror(ret));
This page took 0.026309 seconds and 4 git commands to generate.