MCPcopy Create free account
hub / github.com/apache/cloudstack / DeployDataCenters

Class DeployDataCenters

tools/marvin/marvin/deployDataCenter.py:44–987  ·  view source on GitHub ↗

@Desc : Deploys the Data Center with information provided. Once the Deployment is successful, it will export the DataCenter settings to an obj file ( can be used if wanted to delete the created DC)

Source from the content-addressed store, hash-verified

42
43
44class DeployDataCenters(object):
45
46 '''
47 @Desc : Deploys the Data Center with information provided.
48 Once the Deployment is successful, it will export
49 the DataCenter settings to an obj file
50 ( can be used if wanted to delete the created DC)
51 '''
52
53 def __init__(self,
54 test_client,
55 cfg,
56 logger=None,
57 log_folder_path=None
58 ):
59 self.__testClient = test_client
60 self.__config = cfg
61 self.__tcRunLogger = logger
62 self.__logFolderPath = log_folder_path
63 self.__apiClient = None
64 self.__cleanUp = {}
65
66 def __persistDcConfig(self):
67 try:
68 if self.__logFolderPath:
69 dc_file_path = os.path.join(self.__logFolderPath, "dc_entries.obj")
70 else:
71 ts = strftime("%b_%d_%Y_%H_%M_%S", localtime())
72 dc_file_path = "dc_entries_" + str(ts) + ".obj"
73
74 file_to_write = open(dc_file_path, 'wb')
75 if file_to_write:
76 pickle.dump(self.__cleanUp, file_to_write, protocol=0)
77 print("\n=== Data Center Settings are dumped to %s===" % dc_file_path)
78 self.__tcRunLogger.debug("\n=== Data Center Settings are dumped to %s===" % dc_file_path)
79 except Exception as e:
80 print("Exception Occurred while persisting DC Settings: %s" % \
81 GetDetailExceptionInfo(e))
82
83 def __cleanAndExit(self):
84 try:
85 print("\n===deploy dc failed, so cleaning the created entries===")
86 if not test_data.get("deleteDC", None):
87 print("\n=== Deploy DC Clean Up flag not set. So, exiting ===")
88 exit(1)
89 self.__tcRunLogger.debug(
90 "===Deploy DC Failed, So Cleaning to Exit===")
91 remove_dc_obj = DeleteDataCenters(self.__testClient,
92 dc_cfg=self.__cleanUp,
93 tc_run_logger=self.__tcRunLogger
94 )
95 if remove_dc_obj:
96 if remove_dc_obj.removeDataCenter() == FAILED:
97 print("\n===Removing DataCenter Failed===")
98 self.__tcRunLogger.debug(
99 "===Removing DataCenter Failed===")
100 else:
101 print("\n===Removing DataCenter Successful===")

Callers 2

__deployDCMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected