Skip to content

Commit

Permalink
Fix bug when selecting storage type for AWS (#1759)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
  • Loading branch information
dvaldivia committed Mar 24, 2022
1 parent f582d83 commit bb22a1d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const resourcesConfigurations = {
export const AWSConfigurations: IntegrationConfiguration[] = [
{
typeSelection: "performance",
storageClass: "performance-c6gn-16xlarge",
storageClass: "performance-optimized",
CPU: 64,
memory: 128,
driveSize: { driveSize: "32", sizeUnit: "Gi" },
Expand All @@ -71,7 +71,7 @@ export const AWSConfigurations: IntegrationConfiguration[] = [
},
{
typeSelection: "capacity",
storageClass: "capacity-c6gn-16xlarge",
storageClass: "capacity-optimized",
CPU: 64,
memory: 128,
driveSize: { driveSize: "16", sizeUnit: "Ti" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const addTenantSetStorageTypeReducer = (
let size = state.createTenant.fields.tenantSize.volumeSize;
let sizeFactor = state.createTenant.fields.tenantSize.sizeFactor;
let volumeSize = state.createTenant.fields.tenantSize.volumeSize;
let selectedStorageClass =
state.createTenant.fields.nameTenant.selectedStorageClass;
// for the aws marketplace integration we have some constraints
// on the minimum cluster size

Expand Down Expand Up @@ -60,27 +62,35 @@ export const addTenantSetStorageTypeReducer = (
const mainSelection = configs.find(
(item) => item.typeSelection === action.storageType
);
if (mainSelection !== undefined && mainSelection.minimumVolumeSize) {
const minimumSize = getBytesNumber(
mainSelection.minimumVolumeSize?.driveSize,
mainSelection.minimumVolumeSize?.sizeUnit,
true
);
if (mainSelection !== undefined) {
// store the selected storage class
selectedStorageClass = mainSelection.storageClass;
if (mainSelection.minimumVolumeSize) {
const minimumSize = getBytesNumber(
mainSelection.minimumVolumeSize?.driveSize,
mainSelection.minimumVolumeSize?.sizeUnit,
true
);

const drivesPerServer =
state.createTenant.fields.tenantSize.drivesPerServer;
const nodes = state.createTenant.fields.tenantSize.drivesPerServer;
const drivesPerServer =
state.createTenant.fields.tenantSize.drivesPerServer;
const nodes = state.createTenant.fields.tenantSize.drivesPerServer;

const currentSize = getBytesNumber(size.toString(), sizeFactor, true);
if (currentSize < minimumSize) {
size = minimumSize.toString(10);
const totalSize =
parseInt(nodes) *
parseInt(drivesPerServer) *
parseInt(mainSelection.minimumVolumeSize.driveSize);
const currentSize = getBytesNumber(
size.toString(),
sizeFactor,
true
);
if (currentSize < minimumSize) {
size = minimumSize.toString(10);
const totalSize =
parseInt(nodes) *
parseInt(drivesPerServer) *
parseInt(mainSelection.minimumVolumeSize.driveSize);

volumeSize = totalSize.toString(10);
sizeFactor = mainSelection.minimumVolumeSize.sizeUnit;
volumeSize = totalSize.toString(10);
sizeFactor = mainSelection.minimumVolumeSize.sizeUnit;
}
}
}
}
Expand All @@ -96,6 +106,7 @@ export const addTenantSetStorageTypeReducer = (
nameTenant: {
...state.createTenant.fields.nameTenant,
selectedStorageType: action.storageType,
selectedStorageClass: selectedStorageClass,
},
tenantSize: {
...state.createTenant.fields.tenantSize,
Expand Down

0 comments on commit bb22a1d

Please sign in to comment.