@@ -64,6 +64,10 @@ def __init__(self):
6464 self .__tcRunLogger = None
6565 self .__testModName = ''
6666 self .__hypervisorType = None
67+ '''
68+ The Log Path provided by user where all logs are routed to
69+ '''
70+ self .__userLogPath = None
6771 Plugin .__init__ (self )
6872
6973 def configure (self , options , conf ):
@@ -81,6 +85,7 @@ def configure(self, options, conf):
8185 self .__deployDcFlag = options .deployDc
8286 self .__zoneForTests = options .zone
8387 self .__hypervisorType = options .hypervisor_type
88+ self .__userLogPath = options .logFolder
8489 self .conf = conf
8590 if self .startMarvin () == FAILED :
8691 print "\n Starting Marvin Failed, exiting. Please Check"
@@ -112,6 +117,12 @@ def options(self, parser, env):
112117 dest = "hypervisor_type" ,
113118 help = "Runs all tests against the specified "
114119 "zone and hypervisor Type" )
120+ parser .add_option ("--log-folder-path" , action = "store" ,
121+ default = None ,
122+ dest = "logFolder" ,
123+ help = "Collects all logs under the user specified"
124+ "folder"
125+ )
115126 Plugin .options (self , parser , env )
116127
117128 def wantClass (self , cls ):
@@ -221,7 +232,8 @@ def startMarvin(self):
221232 self .__deployDcFlag ,
222233 None ,
223234 self .__zoneForTests ,
224- self .__hypervisorType )
235+ self .__hypervisorType ,
236+ self .__userLogPath )
225237 if obj_marvininit and obj_marvininit .init () == SUCCESS :
226238 self .__testClient = obj_marvininit .getTestClient ()
227239 self .__tcRunLogger = obj_marvininit .getLogger ()
@@ -275,20 +287,21 @@ def _injectClients(self, test):
275287
276288 def finalize (self , result ):
277289 try :
278- src = self .__logFolderPath
279- log_cfg = self .__parsedConfig .logger
280- tmp = log_cfg .__dict__ .get ('LogFolderPath' ) + "/MarvinLogs"
281- dst = tmp + "//" + random_gen ()
282- mod_name = "test_suite"
283- if self .__testModName :
284- mod_name = self .__testModName .split ("." )
285- if len (mod_name ) > 2 :
286- mod_name = mod_name [- 2 ]
287- if mod_name :
288- dst = tmp + "/" + mod_name + "_" + random_gen ()
289- cmd = "mv " + src + " " + dst
290- os .system (cmd )
291- print "===final results are now copied to: %s===" % str (dst )
290+ if not self .__userLogPath :
291+ src = self .__logFolderPath
292+ log_cfg = self .__parsedConfig .logger
293+ tmp = log_cfg .__dict__ .get ('LogFolderPath' ) + "/MarvinLogs"
294+ dst = tmp + "//" + random_gen ()
295+ mod_name = "test_suite"
296+ if self .__testModName :
297+ mod_name = self .__testModName .split ("." )
298+ if len (mod_name ) > 2 :
299+ mod_name = mod_name [- 2 ]
300+ if mod_name :
301+ dst = tmp + "/" + mod_name + "_" + random_gen ()
302+ cmd = "mv " + src + " " + dst
303+ os .system (cmd )
304+ print "===final results are now copied to: %s===" % str (dst )
292305 except Exception , e :
293306 print "=== Exception occurred under finalize :%s ===" % \
294307 str (GetDetailExceptionInfo (e ))
0 commit comments