From bb22a1d62a29b119b0cd21886d57e5ef4dd38335 Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Wed, 23 Mar 2022 21:01:14 -0700 Subject: [PATCH] Fix bug when selecting storage type for AWS (#1759) Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- .../AddTenant/Steps/TenantResources/utils.tsx | 4 +- .../Tenants/reducers/add-tenant-reducer.ts | 47 ++++++++++++------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/utils.tsx b/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/utils.tsx index 7ce804ae2..0b327c56c 100644 --- a/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/utils.tsx +++ b/portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/utils.tsx @@ -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" }, @@ -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" }, diff --git a/portal-ui/src/screens/Console/Tenants/reducers/add-tenant-reducer.ts b/portal-ui/src/screens/Console/Tenants/reducers/add-tenant-reducer.ts index 9ff3781df..ab693226d 100644 --- a/portal-ui/src/screens/Console/Tenants/reducers/add-tenant-reducer.ts +++ b/portal-ui/src/screens/Console/Tenants/reducers/add-tenant-reducer.ts @@ -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 @@ -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; + } } } } @@ -96,6 +106,7 @@ export const addTenantSetStorageTypeReducer = ( nameTenant: { ...state.createTenant.fields.nameTenant, selectedStorageType: action.storageType, + selectedStorageClass: selectedStorageClass, }, tenantSize: { ...state.createTenant.fields.tenantSize,