def poweron(self, request, frontend_cluster_name, format=None): """Power on the frontend of a named cluster.""" clust = get_object_or_404(Cluster, name=frontend_cluster_name) if not clust.project in request.user.groups.all(): raise PermissionDenied() poweron_nodes.delay([clust.frontend.rocks_name]) return Response(status=204)
def poweron(self, request, compute_name_cluster_name, compute_name, format=None): """Power on the named compute resource in a named cluster. """ compute = get_object_or_404( Compute, name=compute_name, cluster__name=compute_name_cluster_name) if not compute.cluster.project in request.user.groups.all(): raise PermissionDenied() poweron_nodes.delay([compute.rocks_name]) return Response(status=204)
def attach_iso(self, request, frontend_cluster_name, format=None): """Attach an ISO to the frontendresource in a named cluster. """ clust = get_object_or_404(Cluster, name=frontend_cluster_name) if not clust.project in request.user.groups.all(): raise PermissionDenied() poweron_nodes.delay([clust.frontend.rocks_name]) if not "iso_name" in request.GET: return Response("Please provide the iso_name", status=400) attach_iso.delay([clust.frontend.rocks_name], request.GET["iso_name"]) return Response(status=204)
def poweron(self, request, compute_name_cluster_name, compute_name, format=None): """Power on the named compute resource in a named cluster. """ compute = get_object_or_404(Compute, name=compute_name, cluster__name=compute_name_cluster_name) if not compute.cluster.project in request.user.groups.all(): raise PermissionDenied() if not compute.computeset.filter(state=ComputeSet.CSET_STATE_RUNNING).exists(): return Response("Compute is not a member of an active computeset", status=status.HTTP_400_BAD_REQUEST) poweron_nodes.delay([compute.rocks_name]) return Response(status=204)