Allow optional snapshot name and max_size
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 4 Jul 2016 19:25:54 +0000 (15:25 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 4 Jul 2016 19:42:14 +0000 (15:42 -0400)
Generate a default name and give the default max size if not defined.

src/common/config/session-config.c
src/common/config/session.xsd

index e5afc4abc185e1f62007f20439cea188375ab27f..750eb948b96bfa6f9f8d69a9793c66bf0f21520c 100644 (file)
@@ -1218,7 +1218,7 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node)
                        snapshot_output_node; snapshot_output_node =
                        xmlNextElementSibling(snapshot_output_node)) {
                char *name = NULL;
-               uint64_t max_size = UINT64_MAX;
+               uint64_t max_size = DEFAULT_SNAPSHOT_MAX_SIZE;
                struct consumer_output output = { 0 };
                struct lttng_snapshot_output *snapshot_output = NULL;
 
@@ -1262,6 +1262,18 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node)
                        goto error_snapshot_output;
                }
 
+               if (!name) {
+                       /* Generate a default name */
+                       int pret;
+                       pret = asprintf(&name, DEFAULT_SNAPSHOT_NAME "-%" PRIu32,
+                                       lttng_snapshot_output_get_id(snapshot_output));
+                       if (pret < 0) {
+                               name = NULL;
+                               PERROR("snprintf output name");
+                               goto error_snapshot_output;
+                       }
+               }
+
                ret = lttng_snapshot_output_set_name(name, snapshot_output);
                if (ret) {
                        goto error_snapshot_output;
index 9ea83243f9dbfa2edb94f148c621c1045b763a3e..569e4b01151aca1e69acf8489d0fcbc1b2a0f112 100644 (file)
@@ -296,8 +296,8 @@ elementFormDefault="qualified" version="3.0">
 
 <xs:complexType name="snapshot_output_type">
        <xs:all>
-               <xs:element name="name" type="name_type"/>
-               <xs:element name="max_size" type="uint64_type"/>
+               <xs:element name="name" type="name_type" minOccurs="0"/>
+               <xs:element name="max_size" type="uint64_type" minOccurs="0"/>
                <xs:element name="consumer_output" type="consumer_output_type"/>
        </xs:all>
 </xs:complexType>
This page took 0.028515 seconds and 5 git commands to generate.