Skip to content

Commit

Permalink
Fix: max value of PersistentVolumeSizeMib to 512 GB (#112)
Browse files Browse the repository at this point in the history
* Fix: max value of PersistentVolumeSizeMib to 512 GB

* Fix: max value of RootfsVolume need to have same constraint as persistent volumes

* Fix: unit test, rootfs limit is now 512 instead of 100
  • Loading branch information
1yam authored Oct 31, 2024
1 parent 8a62363 commit 66b53cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aleph_message/models/execution/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RootfsVolume(HashableModel):
persistence: VolumePersistence
# Use the same size constraint as persistent volumes for now
size_mib: int = Field(
gt=-1, le=gigabyte_to_mebibyte(Gigabytes(100)), strict=True # Limit to 1GiB
gt=-1, le=gigabyte_to_mebibyte(Gigabytes(512)), strict=True # Limit to 1GiB
)
forgotten_by: Optional[List[str]] = None

Expand Down
2 changes: 1 addition & 1 deletion aleph_message/models/execution/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PersistentVolume(AbstractVolume):
persistence: Optional[VolumePersistence] = None
name: Optional[str] = None
size_mib: int = Field(
gt=0, le=gigabyte_to_mebibyte(Gigabytes(100)), strict=True # Limit to 100GiB
gt=0, le=gigabyte_to_mebibyte(Gigabytes(512)), strict=True # Limit to 512GiB
)

def is_read_only(self):
Expand Down
6 changes: 3 additions & 3 deletions aleph_message/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ def test_volume_size_constraints():
# A ValidationError should be raised if the size negative
with pytest.raises(ValidationError):
_ = create_test_rootfs(size_mib=-1)
size_mib_rootfs: Mebibytes = gigabyte_to_mebibyte(Gigabytes(100))
# A size of 100GiB should be allowed
size_mib_rootfs: Mebibytes = gigabyte_to_mebibyte(Gigabytes(512))
# A size of 512 GiB should be allowed
_ = create_test_rootfs(size_mib=size_mib_rootfs)
# A ValidationError should be raised if the size is greater than 100GiB
# A ValidationError should be raised if the size is greater than 512 GiB
with pytest.raises(ValidationError):
_ = create_test_rootfs(size_mib=size_mib_rootfs + 1)

Expand Down

0 comments on commit 66b53cf

Please sign in to comment.