You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/01/22 14:05:34 UTC

git commit: updated refs/heads/marvin to edfd2b6

Updated Branches:
  refs/heads/marvin 6a2cc9fbd -> edfd2b679


CLOUDSTACK-5764: Some fixes to marvin


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/edfd2b67
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/edfd2b67
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/edfd2b67

Branch: refs/heads/marvin
Commit: edfd2b6799303f290f39be0e8067ad7f07066e91
Parents: 6a2cc9f
Author: Santhosh Edukulla <Sa...@citrix.com>
Authored: Wed Jan 22 18:34:10 2014 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Wed Jan 22 18:34:10 2014 +0530

----------------------------------------------------------------------
 setup/dev/advanced.cfg                  |  2 +-
 tools/marvin/marvin/deployDataCenter.py | 39 +++++++++++++++++++---------
 tools/marvin/marvin/marvinLog.py        | 30 ++++++++++++---------
 3 files changed, 46 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edfd2b67/setup/dev/advanced.cfg
----------------------------------------------------------------------
diff --git a/setup/dev/advanced.cfg b/setup/dev/advanced.cfg
index 7982217..15d1057 100644
--- a/setup/dev/advanced.cfg
+++ b/setup/dev/advanced.cfg
@@ -17,7 +17,7 @@
 {
     "zones": [
         {
-            "name": "Sandbox-simulator-new",
+            "name": "Sandbox-simulator",
             "guestcidraddress": "10.1.1.0/24",
             "dns1": "10.147.28.6",
             "physical_networks": [

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edfd2b67/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 85a31d3..862a1bf 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -659,6 +659,11 @@ class DeployDataCenters(object):
             return FAILED
 
 if __name__ == "__main__":
+    '''
+    @Desc : This facility is mainly to deploy
+            DataCenter by using this module as script
+            by using the input provided configuration.
+    '''
     parser = OptionParser()
     parser.add_option("-i", "--input", action="store",
                       default="./datacenterCfg", dest="input",
@@ -673,22 +678,32 @@ if __name__ == "__main__":
         '''
         from marvin.marvinLog import MarvinLog
         from marvin.cloudstackTestClient import CSTestClient
-
+        '''
+        Step1 : Parse and Create the config from input config provided
+        '''
         cfg = configGenerator.getSetupConfig(options.input)
         log_obj = MarvinLog("CSLog")
-        tcRunLogger = log_obj.setLogHandler("/tmp/debug.log")
-        if tcRunLogger is None:
-            print "\nLogger Creation Failed. " \
-                  "Please Check"
-            exit(1)
+        log_check = False
+        if log_obj is not None:
+            log_check = True
+            ret = log_obj.createLogs("DataCenter",
+                                     cfg.logger)
+            if ret != FAILED:
+                log_folder_path = log_obj.getLogFolderPath()
+                tc_run_logger = log_obj.getLogger()
+        if log_check is False:
+            print "\nLog Creation Failed. Please Check"
         else:
-            print "\nAll Logs Are Available " \
-                  "Under /tmp/debug.log File"
+            print "\nAll Logs will be available under %s" % \
+                  str(log_folder_path)
+        '''
+        Step2: Create the Test Client
+        '''
         obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr,
-                                     logger=tcRunLogger)
-        if obj_tc_client is not None and obj_tc_client.CreateTestClient() \
+                                     logger=tc_run_logger)
+        if obj_tc_client is not None and obj_tc_client.createTestClient() \
                 != FAILED:
-            deploy = DeployDataCenters(obj_tc_client, cfg, tcRunLogger)
+            deploy = DeployDataCenters(obj_tc_client, cfg, tc_run_logger)
             if deploy.deploy() == FAILED:
                 print "\nDeploy DC Failed"
                 exit(1)
@@ -696,7 +711,7 @@ if __name__ == "__main__":
             print "\nTestClient Creation Failed. Please Check"
             exit(1)
     else:
-        print "\n Please Specify a Valid Configuration File"
+        print "\n Please Specify a Valid Input Configuration File"
 
     """
     create = createStoragePool.createStoragePoolCmd()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edfd2b67/tools/marvin/marvin/marvinLog.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinLog.py b/tools/marvin/marvin/marvinLog.py
index 53fbc62..4161eca 100644
--- a/tools/marvin/marvin/marvinLog.py
+++ b/tools/marvin/marvin/marvinLog.py
@@ -65,8 +65,8 @@ class MarvinLog:
         self.__logger = logging.getLogger(self.__loggerName)
         self.__logger.setLevel(logging.DEBUG)
 
-    def setLogHandler(self, log_file_path, log_format=None,
-                      log_level=logging.DEBUG):
+    def __setLogHandler(self, log_file_path, log_format=None,
+                        log_level=logging.DEBUG):
         '''
         @Desc: Adds the given Log handler to the current logger
         @Input: log_file_path: Log File Path as where to store the logs
@@ -89,7 +89,7 @@ class MarvinLog:
             return SUCCESS
         except Exception, e:
             print "\nException Occurred Under " \
-                  "setLogHandler %s" % GetDetailExceptionInfo(e)
+                  "__setLogHandler %s" % GetDetailExceptionInfo(e)
             return FAILED
 
     def __cleanPreviousLogs(self, logfolder_to_remove):
@@ -99,7 +99,12 @@ class MarvinLog:
         @Return: N\A
         @Input: logfolder_to_remove: Path of Log to remove
         '''
-        os.rmdir(logfolder_to_remove)
+        try:
+            os.rmdir(logfolder_to_remove)
+        except Exception, e:
+            print "\n Exception Occurred Under __cleanPreviousLogs :%s" % \
+                  GetDetailExceptionInfo(e)
+            return FAILED
 
     def getLogger(self):
         '''
@@ -134,18 +139,19 @@ class MarvinLog:
                 temp_path = time.strftime("%b_%d_%Y_%H_%M_%S",
                                           time.localtime())
             else:
-                temp_path = test_module_name
+                temp_path = str(test_module_name.split(".py")[0])
 
             if (('LogFolderPath' in log_cfg.__dict__.keys()) and
                     (log_cfg.__dict__.get('LogFolderPath') is not None)):
                 self.__cleanPreviousLogs(log_cfg.
                                          __dict__.
-                                         get('LogFolderPath') + "MarvinLogs/")
-                temp_dir = log_cfg.__dict__.get('LogFolderPath') + "MarvinLogs"
+                                         get('LogFolderPath') + "/MarvinLogs")
+                temp_dir = \
+                    log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs"
             else:
                 temp_dir = "MarvinLogs"
 
-            self.__logFolderDir = temp_dir + temp_path
+            self.__logFolderDir = temp_dir + "//" + temp_path
             print "\n*********Log Folder Path: %s. " \
                   "All logs will be available here **************" \
                   % str(self.__logFolderDir)
@@ -161,10 +167,10 @@ class MarvinLog:
             tc_failed_exception_log = \
                 self.__logFolderDir + "/failed_plus_exceptions.txt"
             tc_run_log = self.__logFolderDir + "/runinfo.txt"
-            if self.setLogHandler(tc_run_log,
-                                  log_level=logging.DEBUG) != FAILED:
-                self.setLogHandler(tc_failed_exception_log,
-                                   log_level=logging.FATAL)
+            if self.__setLogHandler(tc_run_log,
+                                    log_level=logging.DEBUG) != FAILED:
+                self.__setLogHandler(tc_failed_exception_log,
+                                     log_level=logging.FATAL)
                 return SUCCESS
             return FAILED
         except Exception, e: