Skip to content
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
2 changes: 1 addition & 1 deletion src/aleph/vm/controllers/firecracker/executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async def download_kernel(self):

async def download_volumes(self):
volumes = []
# TODO: Download in parallel
# TODO: Download in parallel and prevent duplicated volume names
for i, volume in enumerate(self.message_content.volumes):
# only persistant volume has name and mount
if isinstance(volume, PersistentVolume):
Expand Down
6 changes: 4 additions & 2 deletions src/aleph/vm/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,14 @@
return await get_existing_file(ref)
elif isinstance(volume, PersistentVolume | RootfsVolume):
volume_name = volume.name if isinstance(volume, PersistentVolume) else "rootfs"

if volume.persistence != VolumePersistence.host:
msg = "Only 'host' persistence is supported"
raise NotImplementedError(msg)
if not re.match(r"^[\w\-_/]+$", volume_name):
msg = f"Invalid value for volume name: {repr(volume_name)}"
raise ValueError(msg)
# Sanitize volume names
logger.debug(f"Invalid values for volume name: {repr(volume_name)} detected, sanitizing")
volume_name = re.sub(r"[^\w\-_]", "_", volume_name)

Check warning on line 386 in src/aleph/vm/storage.py

View check run for this annotation

Codecov / codecov/patch

src/aleph/vm/storage.py#L385-L386

Added lines #L385 - L386 were not covered by tests
(Path(settings.PERSISTENT_VOLUMES_DIR) / namespace).mkdir(exist_ok=True)
if volume.parent:
return await create_devmapper(volume, namespace)
Expand Down
Loading