Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fsx): add support for FSx Lustre Persistent_2 deployment type #18626

Merged
merged 6 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export enum LustreDeploymentType {
/**
* Long term storage. Data is replicated and file servers are replaced if they fail.
*/
PERSISTENT_1 = 'PERSISTENT_1'
PERSISTENT_1 = 'PERSISTENT_1',
/**
* Newer type of long term storage with higher throughput tiers.
* Data is replicated and file servers are replaced if they fail.
*/
PERSISTENT_2 = 'PERSISTENT_2',
}

/**
Expand Down Expand Up @@ -276,12 +281,20 @@ export class LustreFileSystem extends FileSystemBase {
private validatePerUnitStorageThroughput(deploymentType: LustreDeploymentType, perUnitStorageThroughput?: number) {
if (perUnitStorageThroughput === undefined) { return; }

if (deploymentType !== LustreDeploymentType.PERSISTENT_1) {
throw new Error('perUnitStorageThroughput can only be set for the PERSISTENT_1 deployment type');
if (deploymentType !== LustreDeploymentType.PERSISTENT_1 && deploymentType !== LustreDeploymentType.PERSISTENT_2) {
throw new Error('perUnitStorageThroughput can only be set for the PERSISTENT_1/PERSISTENT_2 deployment types, received: ' + deploymentType);
}

if (deploymentType === LustreDeploymentType.PERSISTENT_1) {
if (![50, 100, 200].includes(perUnitStorageThroughput)) {
throw new Error('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB for PERSISTENT_1 deployment type, got: ' + perUnitStorageThroughput);
}
}

if (![50, 100, 200].includes(perUnitStorageThroughput)) {
throw new Error('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB');
if (deploymentType === LustreDeploymentType.PERSISTENT_2) {
if (![125, 250, 500, 1000].includes(perUnitStorageThroughput)) {
throw new Error('perUnitStorageThroughput must be 125, 250, 500 or 1000 MB/s/TiB for PERSISTENT_2 deployment type, got: ' + perUnitStorageThroughput);
}
}
}

Expand Down
69 changes: 65 additions & 4 deletions packages/@aws-cdk/aws-fsx/test/lustre-file-system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,16 @@ describe('FSx for Lustre File System', () => {
});
});

test('invalid perUnitStorageThroughput', () => {
test.each([
1,
125,
250,
500,
1000,
])('invalid perUnitStorageThroughput', (invalidValue: number) => {
lustreConfiguration = {
deploymentType: LustreDeploymentType.PERSISTENT_1,
perUnitStorageThroughput: 1,
perUnitStorageThroughput: invalidValue,
};

expect(() => {
Expand All @@ -449,7 +455,7 @@ describe('FSx for Lustre File System', () => {
vpc,
vpcSubnet,
});
}).toThrowError('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB');
}).toThrowError('perUnitStorageThroughput must be 50, 100, or 200 MB/s/TiB for PERSISTENT_1 deployment type, got: ' + invalidValue);
});

test('setting perUnitStorageThroughput on wrong deploymentType', () => {
Expand All @@ -465,7 +471,57 @@ describe('FSx for Lustre File System', () => {
vpc,
vpcSubnet,
});
}).toThrowError('perUnitStorageThroughput can only be set for the PERSISTENT_1 deployment type');
}).toThrowError('perUnitStorageThroughput can only be set for the PERSISTENT_1/PERSISTENT_2 deployment types');
});
});

describe('perUnitStorageThroughput_Persistent_2', () => {
test.each([
125,
250,
500,
1000,
])('valid perUnitStorageThroughput of %d', (throughput: number) => {
lustreConfiguration = {
deploymentType: LustreDeploymentType.PERSISTENT_2,
perUnitStorageThroughput: throughput,
};

new LustreFileSystem(stack, 'FsxFileSystem', {
lustreConfiguration,
storageCapacityGiB: storageCapacity,
vpc,
vpcSubnet,
});

Template.fromStack(stack).hasResourceProperties('AWS::FSx::FileSystem', {
LustreConfiguration: {
DeploymentType: LustreDeploymentType.PERSISTENT_2,
PerUnitStorageThroughput: throughput,
},
});
});

test.each([
1,
50,
100,
200,
550,
])('invalid perUnitStorageThroughput', (invalidValue: number) => {
lustreConfiguration = {
deploymentType: LustreDeploymentType.PERSISTENT_2,
perUnitStorageThroughput: invalidValue,
};

expect(() => {
new LustreFileSystem(stack, 'FsxFileSystem', {
lustreConfiguration,
storageCapacityGiB: storageCapacity,
vpc,
vpcSubnet,
});
}).toThrowError('perUnitStorageThroughput must be 125, 250, 500 or 1000 MB/s/TiB for PERSISTENT_2 deployment type, got: ' + invalidValue);
});
});

Expand All @@ -477,6 +533,9 @@ describe('FSx for Lustre File System', () => {
[1200, LustreDeploymentType.PERSISTENT_1],
[2400, LustreDeploymentType.PERSISTENT_1],
[4800, LustreDeploymentType.PERSISTENT_1],
[1200, LustreDeploymentType.PERSISTENT_2],
[2400, LustreDeploymentType.PERSISTENT_2],
[4800, LustreDeploymentType.PERSISTENT_2],
])('proper multiple for storage capacity of %d on %s', (value: number, deploymentType: LustreDeploymentType) => {
lustreConfiguration = {
deploymentType,
Expand All @@ -502,6 +561,8 @@ describe('FSx for Lustre File System', () => {
[2401, LustreDeploymentType.SCRATCH_2],
[1, LustreDeploymentType.PERSISTENT_1],
[2401, LustreDeploymentType.PERSISTENT_1],
[1, LustreDeploymentType.PERSISTENT_2],
[2401, LustreDeploymentType.PERSISTENT_2],
])('invalid value of %d for storage capacity on %s', (invalidValue: number, deploymentType: LustreDeploymentType) => {
lustreConfiguration = {
deploymentType,
Expand Down