Add --override-url option to load command
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 13 Sep 2016 14:54:23 +0000 (10:54 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 7 Oct 2016 04:44:06 +0000 (00:44 -0400)
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 ec8741b079fa908e5354768203dde55c07c2f5f7..74917a06d1ab1cf63c5d50d8e435708adbd5b923 100644 (file)
@@ -10,7 +10,8 @@ lttng-load - Load LTTng tracing session configurations
 SYNOPSIS
 --------
 [verse]
-*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *load* [option:--force] [option:--input-path='PATH'] ['SESSION']
+*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *load* [option:--force] [option:--input-path='PATH']
+      [option:--override-url='URL]' ['SESSION']
 
 
 DESCRIPTION
@@ -54,6 +55,14 @@ If the input path is a *file*, then:
 * If 'SESSION' is not specified, the option:--all option is implicit:
   all the tracing session configurations found in this file are loaded.
 
+Aspects of the loaded configurations can be overridden at load time.
+
+option:--override-url::
+    Provides the equivalent of the option:--set-url option
+    of the (1)lttng-create command. The validity of the url override is
+    dependant on the type of session(s) to be loaded. Refer to (1)lttng-create for
+    the accepted URL format.
+
 By default, existing tracing sessions are not overwritten when loading:
 the command fails. The option:--force option can be used to allow this.
 
@@ -72,6 +81,9 @@ option:-i, option:--input-path='PATH'::
     or a file, instead of loading them from the default search
     directories.
 
+option:-U, option:--override-url='URL'::
+    Load tracing session configurations and apply an url override
+    while loading. Applies to all sessions loaded.
 
 include::common-cmd-help-options.txt[]
 
index a0f5e1d65befd4f5990def4bd91acd948c6dd3f5..8fa718ed522fced8bdb942c92f26be0f6b366360 100644 (file)
@@ -30,6 +30,7 @@
 #include "../command.h"
 
 static char *opt_input_path;
+static char *opt_override_url;
 static int opt_force;
 static int opt_load_all;
 
@@ -50,6 +51,7 @@ static struct poptOption load_opts[] = {
        {"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},
        {0, 0, 0, 0, 0, 0, 0}
 };
@@ -246,6 +248,16 @@ int cmd_load(int argc, const char **argv)
                goto end;
        }
 
+       /* Set the overrides attributes if any */
+       if (opt_override_url) {
+               ret = lttng_load_session_attr_set_override_url(session_attr,
+                               opt_override_url);
+               if (ret) {
+                       ERR("Url override is invalid");
+                       goto end;
+               }
+       }
+
        ret = lttng_load_session(session_attr);
        if (ret) {
                ERR("%s", lttng_strerror(ret));
@@ -263,6 +275,10 @@ int cmd_load(int argc, const char **argv)
                } else {
                        MSG("Session has been loaded successfully");
                }
+
+               if (opt_override_url) {
+                       MSG("Session output url overridden with %s", opt_override_url);
+               }
                success = 1;
                ret = CMD_SUCCESS;
        }
This page took 0.026901 seconds and 4 git commands to generate.