Honor omit_name and omit_output options in sessiond save command
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 14 Jun 2016 18:53:56 +0000 (14:53 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 29 Jun 2016 15:47:19 +0000 (11:47 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/save.c

index 9ac7712cb114968fdb8c3c4605a4f2f10419037b..7c72ff790cbae050260c80887ed1cd49ae703243 100644 (file)
@@ -1856,6 +1856,7 @@ int save_session(struct ltt_session *session,
        struct config_writer *writer = NULL;
        size_t session_name_len;
        const char *provided_path;
+       bool omit_name, omit_output;
 
        assert(session);
        assert(attr);
@@ -1871,6 +1872,18 @@ int save_session(struct ltt_session *session,
                goto end;
        }
 
+       ret = lttng_save_session_attr_get_omit_name(attr);
+       if (ret < 0) {
+               goto end;
+       }
+       omit_name = !!ret;
+
+       ret = lttng_save_session_attr_get_omit_output(attr);
+       if (ret < 0) {
+               goto end;
+       }
+       omit_output = !!ret;
+
        provided_path = lttng_save_session_attr_get_output_url(attr);
        if (provided_path) {
                DBG3("Save session in provided path %s", provided_path);
@@ -1963,11 +1976,13 @@ int save_session(struct ltt_session *session,
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer, config_element_name,
-                       session->name);
-       if (ret) {
-               ret = LTTNG_ERR_SAVE_IO_FAIL;
-               goto end;
+       if (!omit_name) {
+               ret = config_writer_write_element_string(writer,
+                               config_element_name, session->name);
+               if (ret) {
+                       ret = LTTNG_ERR_SAVE_IO_FAIL;
+                       goto end;
+               }
        }
 
        if(session->shm_path[0] != '\0') {
@@ -2023,9 +2038,11 @@ int save_session(struct ltt_session *session,
                }
        }
 
-       ret = save_session_output(writer, session);
-       if (ret) {
-               goto end;
+       if (!omit_output) {
+               ret = save_session_output(writer, session);
+               if (ret) {
+                       goto end;
+               }
        }
 
        /* /session */
This page took 0.027533 seconds and 5 git commands to generate.