def _check_cluster_isolation(self, cluster_name, qualified_cluster_name):
     cluster_network_isolater = ClusterNetworkIsolater(self.nsxt_client)
     if not cluster_network_isolater.is_cluster_isolated(
             qualified_cluster_name):
         raise ClusterNetworkIsolationError(
             f"Cluster '{cluster_name}' is in an unusable state. Please "
             "delete it and redeploy.")
    def _isolate_cluster(self, cluster_name, qualified_cluster_name,
                         cluster_id):
        if not cluster_id:
            raise ValueError(
                f"Invalid cluster_id for cluster : '{cluster_name}'")

        LOGGER.debug(f"Isolating network of cluster {cluster_name}.")
        try:
            cluster_network_isolater = ClusterNetworkIsolater(self.nsxt_client)
            cluster_network_isolater.isolate_cluster(qualified_cluster_name,
                                                     cluster_id)
        except Exception as err:
            raise ClusterNetworkIsolationError(
                f"Cluster : '{cluster_name}' is in an unusable state. Failed "
                "to isolate cluster network") from err