mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-5764: Some fixes to marvin
This commit is contained in:
parent
6a2cc9fbd0
commit
edfd2b6799
@ -17,7 +17,7 @@
|
|||||||
{
|
{
|
||||||
"zones": [
|
"zones": [
|
||||||
{
|
{
|
||||||
"name": "Sandbox-simulator-new",
|
"name": "Sandbox-simulator",
|
||||||
"guestcidraddress": "10.1.1.0/24",
|
"guestcidraddress": "10.1.1.0/24",
|
||||||
"dns1": "10.147.28.6",
|
"dns1": "10.147.28.6",
|
||||||
"physical_networks": [
|
"physical_networks": [
|
||||||
|
|||||||
@ -659,6 +659,11 @@ class DeployDataCenters(object):
|
|||||||
return FAILED
|
return FAILED
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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 = OptionParser()
|
||||||
parser.add_option("-i", "--input", action="store",
|
parser.add_option("-i", "--input", action="store",
|
||||||
default="./datacenterCfg", dest="input",
|
default="./datacenterCfg", dest="input",
|
||||||
@ -673,22 +678,32 @@ if __name__ == "__main__":
|
|||||||
'''
|
'''
|
||||||
from marvin.marvinLog import MarvinLog
|
from marvin.marvinLog import MarvinLog
|
||||||
from marvin.cloudstackTestClient import CSTestClient
|
from marvin.cloudstackTestClient import CSTestClient
|
||||||
|
'''
|
||||||
|
Step1 : Parse and Create the config from input config provided
|
||||||
|
'''
|
||||||
cfg = configGenerator.getSetupConfig(options.input)
|
cfg = configGenerator.getSetupConfig(options.input)
|
||||||
log_obj = MarvinLog("CSLog")
|
log_obj = MarvinLog("CSLog")
|
||||||
tcRunLogger = log_obj.setLogHandler("/tmp/debug.log")
|
log_check = False
|
||||||
if tcRunLogger is None:
|
if log_obj is not None:
|
||||||
print "\nLogger Creation Failed. " \
|
log_check = True
|
||||||
"Please Check"
|
ret = log_obj.createLogs("DataCenter",
|
||||||
exit(1)
|
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:
|
else:
|
||||||
print "\nAll Logs Are Available " \
|
print "\nAll Logs will be available under %s" % \
|
||||||
"Under /tmp/debug.log File"
|
str(log_folder_path)
|
||||||
|
'''
|
||||||
|
Step2: Create the Test Client
|
||||||
|
'''
|
||||||
obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr,
|
obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr,
|
||||||
logger=tcRunLogger)
|
logger=tc_run_logger)
|
||||||
if obj_tc_client is not None and obj_tc_client.CreateTestClient() \
|
if obj_tc_client is not None and obj_tc_client.createTestClient() \
|
||||||
!= FAILED:
|
!= FAILED:
|
||||||
deploy = DeployDataCenters(obj_tc_client, cfg, tcRunLogger)
|
deploy = DeployDataCenters(obj_tc_client, cfg, tc_run_logger)
|
||||||
if deploy.deploy() == FAILED:
|
if deploy.deploy() == FAILED:
|
||||||
print "\nDeploy DC Failed"
|
print "\nDeploy DC Failed"
|
||||||
exit(1)
|
exit(1)
|
||||||
@ -696,7 +711,7 @@ if __name__ == "__main__":
|
|||||||
print "\nTestClient Creation Failed. Please Check"
|
print "\nTestClient Creation Failed. Please Check"
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print "\n Please Specify a Valid Configuration File"
|
print "\n Please Specify a Valid Input Configuration File"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
create = createStoragePool.createStoragePoolCmd()
|
create = createStoragePool.createStoragePoolCmd()
|
||||||
|
|||||||
@ -65,8 +65,8 @@ class MarvinLog:
|
|||||||
self.__logger = logging.getLogger(self.__loggerName)
|
self.__logger = logging.getLogger(self.__loggerName)
|
||||||
self.__logger.setLevel(logging.DEBUG)
|
self.__logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
def setLogHandler(self, log_file_path, log_format=None,
|
def __setLogHandler(self, log_file_path, log_format=None,
|
||||||
log_level=logging.DEBUG):
|
log_level=logging.DEBUG):
|
||||||
'''
|
'''
|
||||||
@Desc: Adds the given Log handler to the current logger
|
@Desc: Adds the given Log handler to the current logger
|
||||||
@Input: log_file_path: Log File Path as where to store the logs
|
@Input: log_file_path: Log File Path as where to store the logs
|
||||||
@ -89,7 +89,7 @@ class MarvinLog:
|
|||||||
return SUCCESS
|
return SUCCESS
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "\nException Occurred Under " \
|
print "\nException Occurred Under " \
|
||||||
"setLogHandler %s" % GetDetailExceptionInfo(e)
|
"__setLogHandler %s" % GetDetailExceptionInfo(e)
|
||||||
return FAILED
|
return FAILED
|
||||||
|
|
||||||
def __cleanPreviousLogs(self, logfolder_to_remove):
|
def __cleanPreviousLogs(self, logfolder_to_remove):
|
||||||
@ -99,7 +99,12 @@ class MarvinLog:
|
|||||||
@Return: N\A
|
@Return: N\A
|
||||||
@Input: logfolder_to_remove: Path of Log to remove
|
@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):
|
def getLogger(self):
|
||||||
'''
|
'''
|
||||||
@ -134,18 +139,19 @@ class MarvinLog:
|
|||||||
temp_path = time.strftime("%b_%d_%Y_%H_%M_%S",
|
temp_path = time.strftime("%b_%d_%Y_%H_%M_%S",
|
||||||
time.localtime())
|
time.localtime())
|
||||||
else:
|
else:
|
||||||
temp_path = test_module_name
|
temp_path = str(test_module_name.split(".py")[0])
|
||||||
|
|
||||||
if (('LogFolderPath' in log_cfg.__dict__.keys()) and
|
if (('LogFolderPath' in log_cfg.__dict__.keys()) and
|
||||||
(log_cfg.__dict__.get('LogFolderPath') is not None)):
|
(log_cfg.__dict__.get('LogFolderPath') is not None)):
|
||||||
self.__cleanPreviousLogs(log_cfg.
|
self.__cleanPreviousLogs(log_cfg.
|
||||||
__dict__.
|
__dict__.
|
||||||
get('LogFolderPath') + "MarvinLogs/")
|
get('LogFolderPath') + "/MarvinLogs")
|
||||||
temp_dir = log_cfg.__dict__.get('LogFolderPath') + "MarvinLogs"
|
temp_dir = \
|
||||||
|
log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs"
|
||||||
else:
|
else:
|
||||||
temp_dir = "MarvinLogs"
|
temp_dir = "MarvinLogs"
|
||||||
|
|
||||||
self.__logFolderDir = temp_dir + temp_path
|
self.__logFolderDir = temp_dir + "//" + temp_path
|
||||||
print "\n*********Log Folder Path: %s. " \
|
print "\n*********Log Folder Path: %s. " \
|
||||||
"All logs will be available here **************" \
|
"All logs will be available here **************" \
|
||||||
% str(self.__logFolderDir)
|
% str(self.__logFolderDir)
|
||||||
@ -161,10 +167,10 @@ class MarvinLog:
|
|||||||
tc_failed_exception_log = \
|
tc_failed_exception_log = \
|
||||||
self.__logFolderDir + "/failed_plus_exceptions.txt"
|
self.__logFolderDir + "/failed_plus_exceptions.txt"
|
||||||
tc_run_log = self.__logFolderDir + "/runinfo.txt"
|
tc_run_log = self.__logFolderDir + "/runinfo.txt"
|
||||||
if self.setLogHandler(tc_run_log,
|
if self.__setLogHandler(tc_run_log,
|
||||||
log_level=logging.DEBUG) != FAILED:
|
log_level=logging.DEBUG) != FAILED:
|
||||||
self.setLogHandler(tc_failed_exception_log,
|
self.__setLogHandler(tc_failed_exception_log,
|
||||||
log_level=logging.FATAL)
|
log_level=logging.FATAL)
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
return FAILED
|
return FAILED
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user