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

Validate FSx Params #904

Merged
merged 1 commit into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
36 changes: 24 additions & 12 deletions cli/pcluster/cfnconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,15 @@ def __check_option_absent_awsbatch(self, option):
if self.__config.has_option(self.__cluster_section, option):
self.__fail("option %s cannot be used with awsbatch" % option)

def __validate_awsbatch_os(self, baseos):
supported_batch_oses = ["alinux"]
if baseos not in supported_batch_oses:
self.__fail("awsbatch scheduler supports following OSes: %s" % supported_batch_oses)
def __get_os(self):
base_os = "alinux"
if self.__config.has_option(self.__cluster_section, "base_os"):
base_os = self.__config.get(self.__cluster_section, "base_os")
return base_os

def __validate_os(self, service, baseos, supported_oses):
if baseos not in supported_oses:
self.__fail("%s supports following OSes: %s" % (service, supported_oses))

def __init_batch_parameters(self): # noqa: C901 FIXME!!!
"""
Expand All @@ -596,8 +601,7 @@ def __init_batch_parameters(self): # noqa: C901 FIXME!!!
self.__check_option_absent_awsbatch("max_queue_size")
self.__check_option_absent_awsbatch("spot_price")

if self.__config.has_option(self.__cluster_section, "base_os"):
self.__validate_awsbatch_os(self.__config.get(self.__cluster_section, "base_os"))
self.__validate_os("awsbatch", self.__get_os(), ["alinux"])

if self.__config.has_option(self.__cluster_section, "compute_instance_type"):
compute_instance_type = self.__config.get(self.__cluster_section, "compute_instance_type")
Expand Down Expand Up @@ -799,6 +803,9 @@ def __init_fsx_parameters(self):
if not fsx_section:
return

# Check that the base_os is supported
self.__validate_os("FSx", self.__get_os(), ["centos7"])

# Dictionary list of all FSx options
fsx_options = OrderedDict(
[
Expand All @@ -807,7 +814,7 @@ def __init_fsx_parameters(self):
("storage_capacity", ("FSXCapacity", "FSx_storage_capacity")),
("fsx_kms_key_id", ("FSXKMSKeyId", None)),
("imported_file_chunk_size", ("ImportedFileChunkSize", "FSx_imported_file_chunk_size")),
("export_path", ("ExportPath", None)),
("export_path", ("ExportPath", "FSx_export_path")),
("import_path", ("ImportPath", None)),
("weekly_maintenance_start_time", ("WeeklyMaintenanceStartTime", None)),
]
Expand All @@ -819,11 +826,16 @@ def __init_fsx_parameters(self):
if not value:
temp_fsx_options.append("NONE")
else:
# Separate sanity_check for fs_id, need to pass in fs_id and subnet_id
if self.__sanity_check and fsx_options.get(key)[1] == "fsx_fs_id":
self.__validate_resource("fsx_fs_id", (value, self.__master_subnet))
elif self.__sanity_check and fsx_options.get(key)[1] is not None:
self.__validate_resource(fsx_options.get(key)[1], value)
if self.__sanity_check:
# Separate sanity_check for fs_id, need to pass in fs_id and subnet_id
if fsx_options.get(key)[1] == "fsx_fs_id":
self.__validate_resource("fsx_fs_id", (value, self.__master_subnet))
elif fsx_options.get(key)[1] in ["FSx_imported_file_chunk_size", "FSx_export_path"]:
self.__validate_resource(
fsx_options.get(key)[1], (value, self.__get_option_in_section(fsx_section, "import_path"))
)
elif fsx_options.get(key)[1] is not None:
self.__validate_resource(fsx_options.get(key)[1], value)
temp_fsx_options.append(value)
self.parameters["FSXOptions"] = ",".join(temp_fsx_options)

Expand Down
8 changes: 6 additions & 2 deletions cli/pcluster/config_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,14 @@ def __validate_fsx_parameters(self, resource_type, resource_value):
self.__fail(
resource_type, "Capacity for FSx lustre filesystem, minimum of 3,600 GB, increments of 3,600 GB"
)
# Check to see if import_path is specified with imported_file_chunk_size and export_path
elif resource_type in ["FSx_imported_file_chunk_size", "FSx_export_path"]:
if resource_value[1] is None:
self.__fail(resource_type, "import_path must be specified.")
# FSX file chunk size check
elif resource_type == "FSx_imported_file_chunk_size":
# 1,024 MiB (1 GiB) and can go as high as 512,000 MiB
if not (1 <= int(resource_value) <= 512000):
if not (1 <= int(resource_value[0]) <= 512000):
self.__fail(resource_type, "has a minimum size of 1 MiB, and max size of 512,000 MiB")

def validate(self, resource_type, resource_value): # noqa: C901 FIXME
Expand Down Expand Up @@ -513,7 +517,7 @@ def validate(self, resource_type, resource_value): # noqa: C901 FIXME
"Needs min of 2 volumes for RAID and max of 5 EBS volumes are currently supported.",
)
# FSX FS Id check
elif resource_type in ["fsx_fs_id", "FSx_storage_capacity", "FSx_imported_file_chunk_size"]:
elif resource_type in ["fsx_fs_id", "FSx_storage_capacity", "FSx_imported_file_chunk_size", "FSx_export_path"]:
self.__validate_fsx_parameters(resource_type, resource_value)
# Batch Parameters
elif resource_type == "AWSBatch_Parameters":
Expand Down
6 changes: 6 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,12 @@ FSx
Configuration for an attached FSx Lustre file system. See `FSx CreateFileSystem
<https://docs.aws.amazon.com/fsx/latest/APIReference/API_CreateFileSystem.html>`_ for more information.

FSx Lustre is only supported when ``base_os = centos7``.

If using an existing file system, it must be associated to a security group that allows inbound and outbound
TCP traffic from ``0.0.0.0/0`` through port ``988``. This is done by automatically when not using
``vpc_security_group_id``.

Use an existing FSx file system by specifying ``fsx_fs_id``. ::

[fsx fs]
Expand Down