Skip to content

Commit

Permalink
[PLAT-15569] Block pause universe if it has ephemeral storage
Browse files Browse the repository at this point in the history
Summary: Pausing a universe with ephemeral storage will cause dataloss, so block it.

Test Plan: paused universe with ephemeral storage. it failed the API

Reviewers: muthu, nsingh

Reviewed By: muthu, nsingh

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D41699
  • Loading branch information
shubin-yb committed Feb 5, 2025
1 parent 2d3924e commit 7ff1580
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@

package com.yugabyte.yw.commissioner.tasks;

import static play.mvc.Http.Status.BAD_REQUEST;

import com.yugabyte.yw.commissioner.BaseTaskDependencies;
import com.yugabyte.yw.commissioner.UserTaskDetails.SubTaskGroupType;
import com.yugabyte.yw.common.PlatformServiceException;
import com.yugabyte.yw.forms.UniverseDefinitionTaskParams;
import com.yugabyte.yw.forms.UniverseTaskParams;
import com.yugabyte.yw.models.Universe;
import java.util.UUID;
Expand All @@ -34,6 +38,19 @@ public Params params() {
return (Params) taskParams;
}

@Override
public void validateParams(boolean isFirstTry) {
super.validateParams(isFirstTry);
if (isFirstTry) {
// Verify the task params.
Universe universe = Universe.getOrBadRequest(taskParams().getUniverseUUID());
if (UniverseDefinitionTaskParams.hasEphemeralStorage(universe.getUniverseDetails())) {
throw new PlatformServiceException(
BAD_REQUEST, "Cannot pause universe with ephemeral storage");
}
}
}

@Override
public void run() {
try {
Expand Down

0 comments on commit 7ff1580

Please sign in to comment.