Skip to content

Commit

Permalink
[BACKPORT 2.21.1.3269][PLAT-13808] Pass machineImage for disk update …
Browse files Browse the repository at this point in the history
…operation from the java layer

Summary:
Passes the machineImage if present in the nodeDetails as the args for disk update operation.
The order is -
1. use the machineImage present in the nodeDetails.
2. Fallback to the AMI present in the bundle.
3. Use the AMI id present in the host.

Depends on - D34811
Original Commit - 6965586

Test Plan:
Created a universe using machineImage on the fly.
Deleted the AMI from the console.
Performed disk update - verified that it fails.

Performed VM Image Upgrade.
Peformed disk update - Verified that it passes.

Reviewers: muthu, daniel, yshchetinin

Reviewed By: yshchetinin

Subscribers: yugaware

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34823
  • Loading branch information
Vars-07 committed May 7, 2024
1 parent a8069eb commit e32f226
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,10 @@ public SubTaskGroup createUpdateDiskSizeTasks(
.deviceInfo
.numVolumes;
}

if (StringUtils.isNotEmpty(node.machineImage)) {
params.machineImage = node.machineImage;
}
// Add the universe uuid.
params.setUniverseUUID(taskParams().getUniverseUUID());
// Add the az uuid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2595,6 +2595,9 @@ protected SubTaskGroup createUpdateMountedDisksTask(
params.azUuid = node.azUuid;
params.instanceType = currentInstanceType;
params.deviceInfo = currentDeviceInfo;
if (StringUtils.isNotEmpty(node.machineImage)) {
params.machineImage = node.machineImage;
}

UpdateMountedDisks updateMountedDisksTask = createTask(UpdateMountedDisks.class);
updateMountedDisksTask.initialize(params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static class Params extends NodeTaskParams {
// CSV of tag keys to be deleted.
public String deleteTags = "";
public boolean force = false;
public String machineImage;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ protected UpdateMountedDisks(BaseTaskDependencies baseTaskDependencies) {
super(baseTaskDependencies);
}

public static class Params extends NodeTaskParams {}
public static class Params extends NodeTaskParams {
public String machineImage;
}

@Override
protected Params taskParams() {
Expand Down
10 changes: 8 additions & 2 deletions managed/src/main/java/com/yugabyte/yw/common/NodeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2286,7 +2286,10 @@ public ShellResponse nodeCommand(NodeCommandType type, NodeTaskParams nodeTaskPa
throw new RuntimeException("NodeTaskParams is not InstanceActions.Params");
}
InstanceActions.Params taskParam = (InstanceActions.Params) nodeTaskParam;
if (toOverwriteNodeProperties != null) {
if (StringUtils.isNotEmpty(taskParam.machineImage)) {
commandArgs.add("--machine_image");
commandArgs.add(taskParam.machineImage);
} else if (toOverwriteNodeProperties != null) {
String ybImage = toOverwriteNodeProperties.getMachineImage();
if (StringUtils.isNotBlank(ybImage)) {
commandArgs.add("--machine_image");
Expand All @@ -2309,7 +2312,10 @@ public ShellResponse nodeCommand(NodeCommandType type, NodeTaskParams nodeTaskPa
throw new RuntimeException("NodeTaskParams is not UpdateMountedDisksTask.Params");
}
UpdateMountedDisks.Params taskParam = (UpdateMountedDisks.Params) nodeTaskParam;
if (toOverwriteNodeProperties != null) {
if (StringUtils.isNotEmpty(taskParam.machineImage)) {
commandArgs.add("--machine_image");
commandArgs.add(taskParam.machineImage);
} else if (toOverwriteNodeProperties != null) {
String ybImage = toOverwriteNodeProperties.getMachineImage();
if (StringUtils.isNotBlank(ybImage)) {
commandArgs.add("--machine_image");
Expand Down

0 comments on commit e32f226

Please sign in to comment.