@Desc : Deletes the Data Center using the settings provided. tc_client :Client for deleting the DC. dc_cfg_file : obj file exported by DeployDataCenter when successfully created DC. This file is serialized one containing
| 987 | self.__cleanAndExit() |
| 988 | |
| 989 | class DeleteDataCenters: |
| 990 | |
| 991 | ''' |
| 992 | @Desc : Deletes the Data Center using the settings provided. |
| 993 | tc_client :Client for deleting the DC. |
| 994 | dc_cfg_file : obj file exported by DeployDataCenter |
| 995 | when successfully created DC. |
| 996 | This file is serialized one containing |
| 997 | entries with successful DC. |
| 998 | dc_cfg: If dc_cfg_file, is not available, we can use |
| 999 | the dictionary of elements to delete. |
| 1000 | tc_run_logger: Logger to dump log messages. |
| 1001 | ''' |
| 1002 | |
| 1003 | def __init__(self, |
| 1004 | tc_client, |
| 1005 | dc_cfg_file=None, |
| 1006 | dc_cfg=None, |
| 1007 | tc_run_logger=None |
| 1008 | ): |
| 1009 | self.__dcCfgFile = dc_cfg_file |
| 1010 | self.__dcCfg = dc_cfg |
| 1011 | self.__tcRunLogger = tc_run_logger |
| 1012 | self.__apiClient = None |
| 1013 | self.__testClient = tc_client |
| 1014 | |
| 1015 | def __deleteCmds(self, cmd_name, cmd_obj): |
| 1016 | ''' |
| 1017 | @Name : __deleteCmds |
| 1018 | @Desc : Deletes the entities provided by cmd |
| 1019 | ''' |
| 1020 | if cmd_name.lower() == "deletehostcmd": |
| 1021 | cmd_obj.forcedestroylocalstorage = "true" |
| 1022 | cmd_obj.force = "true" |
| 1023 | ''' |
| 1024 | Step1 : Prepare Host For Maintenance |
| 1025 | ''' |
| 1026 | host_maint_cmd = prepareHostForMaintenance.\ |
| 1027 | prepareHostForMaintenanceCmd() |
| 1028 | host_maint_cmd.id = cmd_obj.id |
| 1029 | host_maint_resp = self.__apiClient.prepareHostForMaintenance( |
| 1030 | host_maint_cmd) |
| 1031 | if host_maint_resp: |
| 1032 | ''' |
| 1033 | Step2 : List Hosts for Resource State |
| 1034 | ''' |
| 1035 | list_host_cmd = listHosts.listHostsCmd() |
| 1036 | list_host_cmd.id = cmd_obj.id |
| 1037 | retries = 3 |
| 1038 | for i in range(retries): |
| 1039 | list_host_resp = self.__apiClient.\ |
| 1040 | listHosts(list_host_cmd) |
| 1041 | if (list_host_resp) and\ |
| 1042 | (list_host_resp[0].resourcestate == 'Maintenance'): |
| 1043 | break |
| 1044 | sleep(30) |
| 1045 | if cmd_name.lower() == "deletestoragepoolcmd": |
| 1046 | cmd_obj.forced = "true" |
no outgoing calls
no test coverage detected