Esempio n. 1
0
    def activate_srm(self):
        try:
            srm_activation_task = self.vmc_client.draas.SiteRecovery.post(
                self.org_id, self.sddc_id)
        except InvalidRequest as e:
            # Convert InvalidRequest to ErrorResponse to get error message
            error_response = e.data.convert_to(ErrorResponse)
            raise Exception(error_response.error_messages)

        wait_for_task(task_client=self.vmc_client.draas.Task,
                      org_id=self.org_id,
                      task_id=srm_activation_task.id,
                      interval_sec=self.interval_sec)
    def delete_node(self, node_id):
        if self.cleanup:
            print("\nRemoving Additional Site Recovery Instance")
            try:
                srm_deactivation_task = self.vmc_client.draas.SiteRecoverySrmNodes.delete(
                    self.org_id, self.sddc_id, node_id)
            except InvalidRequest as e:
                # Convert InvalidRequest to ErrorResponse to get error message
                error_response = e.data.convert_to(ErrorResponse)
                raise Exception(error_response.error_messages)

            wait_for_task(task_client=self.vmc_client.draas.Task,
                          org_id=self.org_id,
                          task_id=srm_deactivation_task.id,
                          interval_sec=self.interval_sec)
    def deploy_srm(self):
        try:
            print("Deploying Additional Site Recovery Instance")
            deployment_task = self.vmc_client.draas.SiteRecoverySrmNodes.post(
                self.org_id, self.sddc_id,
                ProvisionSrmConfig(
                    srm_extension_key_suffix=self.extension_key))
        except InvalidRequest as e:
            # Convert InvalidRequest to ErrorResponse to get error message
            error_response = e.data.convert_to(ErrorResponse)
            raise Exception(error_response.error_messages)

        wait_for_task(task_client=self.vmc_client.draas.Task,
                      org_id=self.org_id,
                      task_id=deployment_task.id,
                      interval_sec=self.interval_sec)
        return deployment_task.resource_id