You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2013/12/10 21:24:15 UTC
git commit: updated refs/heads/4.3 to 1605e55
Updated Branches:
refs/heads/4.3 4ee3fdbde -> 1605e55eb
CLOUDSTACK-5449: fix the log creation failure case and added an option
for user to provide --log-folder-path=
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1605e55e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1605e55e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1605e55e
Branch: refs/heads/4.3
Commit: 1605e55ebdd9ba848217596f14fbf15a09fde0e9
Parents: 4ee3fdb
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Wed Dec 11 01:52:34 2013 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 11 01:52:34 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/marvinInit.py | 22 +++++++++++++++-------
tools/marvin/marvin/marvinPlugin.py | 6 +++++-
2 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1605e55e/tools/marvin/marvin/marvinInit.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py
index 17ee9bd..2bbf119 100644
--- a/tools/marvin/marvin/marvinInit.py
+++ b/tools/marvin/marvin/marvinInit.py
@@ -39,14 +39,16 @@ import sys
import time
import os
import logging
+import string
+import random
class MarvinInit:
- def __init__(self, config_file, load_flag):
+ def __init__(self, config_file, load_flag, log_folder_path=None):
self.__configFile = config_file
self.__loadFlag = load_flag
self.__parsedConfig = None
- self.__logFolderPath = None
+ self.__logFolderPath = log_folder_path
self.__tcRunLogger = None
self.__testClient = None
self.__tcRunDebugFile = None
@@ -111,15 +113,21 @@ class MarvinInit:
for a given test run are available under a given
timestamped folder
'''
- log_config = self.__parsedConfig.logger
temp_path = "".join(str(time.time()).split("."))
- if log_config is not None:
- if log_config.LogFolderPath is not None:
- self.logFolderPath = log_config.LogFolderPath + temp_path
+ if self.__logFolderPath is None:
+ log_config = self.__parsedConfig.logger
+ if log_config is not None:
+ if log_config.LogFolderPath is not None:
+ self.logFolderPath = log_config.LogFolderPath + '/' + temp_path
+ else:
+ self.logFolderPath = temp_path
else:
self.logFolderPath = temp_path
else:
- self.logFolderPath = temp_path
+ self.logFolderPath = self.__logFolderPath + '/' + temp_path
+ if os.path.exists(self.logFolderPath):
+ self.logFolderPath = self.logFolderPath \
+ + ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3))
os.makedirs(self.logFolderPath)
'''
Log File Paths
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1605e55e/tools/marvin/marvin/marvinPlugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index 540ede9..1353352 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -68,6 +68,7 @@ class MarvinPlugin(Plugin):
self.enabled = True
self.configFile = options.config_file
self.loadFlag = options.load
+ self.logFolderPath = options.log_folder_path
self.conf = conf
'''
Initializes the marvin with required settings
@@ -87,6 +88,9 @@ class MarvinPlugin(Plugin):
parser.add_option("--load", action="store_true", default=False,
dest="load",
help="Only load the deployment configuration given")
+ parser.add_option("--log-folder-path", action="store", default=None,
+ dest="log_folder_path",
+ help="Path to the folder where log files will be stored")
Plugin.options(self, parser, env)
def wantClass(self, cls):
@@ -165,7 +169,7 @@ class MarvinPlugin(Plugin):
Creates a debugstream for tc debug log
'''
try:
- obj_marvininit = MarvinInit(self.configFile, self.loadFlag)
+ obj_marvininit = MarvinInit(self.configFile, self.loadFlag, self.logFolderPath)
if obj_marvininit.init() == SUCCESS:
self.testClient = obj_marvininit.getTestClient()
self.tcRunLogger = obj_marvininit.getLogger()