Fixed issues in CLOUDSTACK-6489 Fixed issues for CLOUDSTACK-6489 Along with fixed few indent issues. Signed-off-by: Santhosh Edukulla <Santhosh.Edukulla@citrix.com> Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index 1410e6f..8c2c7ab 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py
@@ -188,6 +188,10 @@ "name": "testvm2", "displayname": "Test VM2", }, + "virtual_machine3": { + "name": "testvm3", + "displayname": "Test VM3", + }, "server_without_disk": { "displayname": "Test VM-No Disk", "username": "root", @@ -569,5 +573,25 @@ "startip": "10.223.252.196", "endip": "10.223.252.197", "vlan": "1001" + }, + "sparse": { + "name": "Sparse Type Disk offering", + "displaytext": + "Sparse Type Disk offering", + "disksize": 1, # in GB + "provisioningtype": "sparse" + }, + "fat": { + "name": "Fat Type Disk offering", + "displaytext": + "Fat Type Disk offering", + "disksize": 1, # in GB + "provisioningtype": "fat" + }, + "sparse_disk_offering": { + "displaytext": "Sparse", + "name": "Sparse", + "provisioningtype": "sparse", + "disksize": 1 } }
diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py index ba7c4de..c35fec6 100644 --- a/tools/marvin/marvin/marvinInit.py +++ b/tools/marvin/marvin/marvinInit.py
@@ -43,7 +43,8 @@ deploy_dc_flag=None, test_mod_name="deploydc", zone=None, - hypervisor_type=None): + hypervisor_type=None, + user_logfolder_path=None): self.__configFile = config_file self.__deployFlag = deploy_dc_flag self.__logFolderPath = None @@ -55,6 +56,7 @@ self.__zoneForTests = zone self.__parsedConfig = None self.__hypervisorType = hypervisor_type + self.__userLogFolderPath = user_logfolder_path def __parseConfig(self): ''' @@ -162,7 +164,8 @@ if log_obj: ret = log_obj.\ createLogs(self.__testModName, - self.__parsedConfig.logger) + self.__parsedConfig.logger, + self.__userLogFolderPath) if ret != FAILED: self.__logFolderPath = log_obj.getLogFolderPath() self.__tcRunLogger = log_obj.getLogger()
diff --git a/tools/marvin/marvin/marvinLog.py b/tools/marvin/marvin/marvinLog.py index 6168987..65687aa 100644 --- a/tools/marvin/marvin/marvinLog.py +++ b/tools/marvin/marvin/marvinLog.py
@@ -127,7 +127,8 @@ def createLogs(self, test_module_name=None, - log_cfg=None): + log_cfg=None, + user_provided_logpath=None): ''' @Name : createLogs @Desc : Gets the Logger with file paths initialized and created @@ -135,6 +136,10 @@ creating log folder path log_cfg: Log Configuration provided inside of Configuration + user_provided_logpath:LogPath provided by user + If user provided log path + is available, then one in cfg + will not be picked up. @Output : SUCCESS\FAILED ''' try: @@ -146,8 +151,9 @@ temp_path = str(test_module_name) + \ "__" + str(temp_ts) + "_" + random_gen() - temp_dir = "MarvinLogs" - if ((log_cfg is not None) and + if user_provided_logpath: + temp_dir = user_provided_logpath + elif ((log_cfg is not None) and ('LogFolderPath' in log_cfg.__dict__.keys()) and (log_cfg.__dict__.get('LogFolderPath') is not None)): temp_dir = \
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py index ae839e8..4200a65 100644 --- a/tools/marvin/marvin/marvinPlugin.py +++ b/tools/marvin/marvin/marvinPlugin.py
@@ -64,6 +64,10 @@ self.__tcRunLogger = None self.__testModName = '' self.__hypervisorType = None + ''' + The Log Path provided by user where all logs are routed to + ''' + self.__userLogPath = None Plugin.__init__(self) def configure(self, options, conf): @@ -81,6 +85,7 @@ self.__deployDcFlag = options.deployDc self.__zoneForTests = options.zone self.__hypervisorType = options.hypervisor_type + self.__userLogPath = options.logFolder self.conf = conf if self.startMarvin() == FAILED: print "\nStarting Marvin Failed, exiting. Please Check" @@ -112,6 +117,12 @@ dest="hypervisor_type", help="Runs all tests against the specified " "zone and hypervisor Type") + parser.add_option("--log-folder-path", action="store", + default=None, + dest="logFolder", + help="Collects all logs under the user specified" + "folder" + ) Plugin.options(self, parser, env) def wantClass(self, cls): @@ -221,7 +232,8 @@ self.__deployDcFlag, None, self.__zoneForTests, - self.__hypervisorType) + self.__hypervisorType, + self.__userLogPath) if obj_marvininit and obj_marvininit.init() == SUCCESS: self.__testClient = obj_marvininit.getTestClient() self.__tcRunLogger = obj_marvininit.getLogger() @@ -275,20 +287,21 @@ def finalize(self, result): try: - src = self.__logFolderPath - log_cfg = self.__parsedConfig.logger - tmp = log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs" - dst = tmp + "//" + random_gen() - mod_name = "test_suite" - if self.__testModName: - mod_name = self.__testModName.split(".") - if len(mod_name) > 2: - mod_name = mod_name[-2] - if mod_name: - dst = tmp + "/" + mod_name + "_" + random_gen() - cmd = "mv " + src + " " + dst - os.system(cmd) - print "===final results are now copied to: %s===" % str(dst) + if not self.__userLogPath: + src = self.__logFolderPath + log_cfg = self.__parsedConfig.logger + tmp = log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs" + dst = tmp + "//" + random_gen() + mod_name = "test_suite" + if self.__testModName: + mod_name = self.__testModName.split(".") + if len(mod_name) > 2: + mod_name = mod_name[-2] + if mod_name: + dst = tmp + "/" + mod_name + "_" + random_gen() + cmd = "mv " + src + " " + dst + os.system(cmd) + print "===final results are now copied to: %s===" % str(dst) except Exception, e: print "=== Exception occurred under finalize :%s ===" % \ str(GetDetailExceptionInfo(e))