Kiril Nesenko has uploaded a new change for review. Change subject: Add new --output option. ......................................................................
Add new --output option. * Added --output option to store the LC report * Update the man page accordingly Change-Id: Iba8ec7c6d65901158ede692f0ba51c07178298d9 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=977863 Signed-off-by: Kiril Nesenko <[email protected]> --- M src/__main__.py M src/engine-log-collector.8 2 files changed, 23 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector refs/changes/81/18781/1 diff --git a/src/__main__.py b/src/__main__.py index 7a5d97c..329de80 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -895,14 +895,21 @@ report_file_ext = 'bz2' compressor = 'bzip2' caller = Caller({}) + output_dir = tempfile.gettempdir() try: caller.call('xz --version') report_file_ext = 'xz' compressor = 'xz' except Exception: logging.debug('xz compression not available') + + if self.conf["output"]: + output_dir = self.conf["output"] + if not os.path.exists(output_dir): + os.makedirs(output_dir) + self.conf["path"] = os.path.join( - tempfile.gettempdir(), + output_dir, "sosreport-%s-%s.tar.%s" % ( 'LogCollector', time.strftime("%Y%m%d%H%M%S"), @@ -912,7 +919,7 @@ if self.conf["ticket_number"]: self.conf["path"] = os.path.join( - tempfile.gettempdir(), + output_dir, "sosreport-%s-%s-%s.tar.%s" % ( 'LogCollector', self.conf["ticket_number"], @@ -1266,8 +1273,10 @@ parser.add_option( "", "--local-tmp", dest="local_tmp_dir", - help="directory to copy reports to locally \ -(default is randomly generated like: %s)" % DEFAULT_SCRATCH_DIR, + help="directory to copy reports to locally " + "Please note that the local-tmp directory is used " + "only for storing temporary reports gathered from hypervisors." + "(default is randomly generated like: %s)" % DEFAULT_SCRATCH_DIR, metavar="PATH", default=DEFAULT_SCRATCH_DIR ) @@ -1319,6 +1328,11 @@ action="store_true", default=False ) + parser.add_option( + "", "--output", dest="output", + help="Destination directory where the report will be stored" + ) + engine_group = OptionGroup( parser, "oVirt Engine Configuration", diff --git a/src/engine-log-collector.8 b/src/engine-log-collector.8 index c6800b5..d0c5889 100644 --- a/src/engine-log-collector.8 +++ b/src/engine-log-collector.8 @@ -56,7 +56,7 @@ .IP "\fB\-\-local\-tmp=PATH\fP" -Local directory where reports are copied (default=/tmp/logcollector).\& +Local directory where reports are copied (default=/tmp/logcollector). Please note that the directory is used only for storing temporary reports gathered from hypervisors.\& .IP "\fB\-\-config\-file=PATH\fP" @@ -82,6 +82,10 @@ Display verbose output.\& +.IP "\fB\-\-output\fP" + +Destination directory where the report will be stored.\& + .SH "oVirt Engine CONFIGURATION OPTIONS" The options in the oVirt Engine configuration group can be used to filter log collection from one or more hypervisors. If the \-\-no\-hypervisors option is specified, data is not collected from any hypervisor. Wild card globbing (*, ?, []) can be used to match names.\& -- To view, visit http://gerrit.ovirt.org/18781 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iba8ec7c6d65901158ede692f0ba51c07178298d9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-log-collector Gerrit-Branch: master Gerrit-Owner: Kiril Nesenko <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
