Skip to content
Open
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
1 change: 1 addition & 0 deletions changes/12969.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reject vfolder mount aliases set to exactly `/home/work`, which collided with the intrinsic scratch mount and made container creation fail with "Duplicate mount point"
4 changes: 4 additions & 0 deletions src/ai/backend/common/defs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class RedisRole(StrEnum):
".jupyter",
".tmux.conf",
".ssh",
# The agent always bind-mounts the scratch directory at /home/work,
# so mounting a vfolder exactly there makes dockerd reject the container
# with "Duplicate mount point: /home/work".
"/home/work",
"/bin",
"/boot",
"/dev",
Expand Down
28 changes: 0 additions & 28 deletions src/ai/backend/manager/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import enum
import re
from typing import Final

from ai.backend.common.arch import CURRENT_ARCH
Expand Down Expand Up @@ -42,34 +41,7 @@ def is_noop_host(vfolder_host: str) -> bool:

PASSWORD_PLACEHOLDER: Final = "*****"

_RESERVED_VFOLDER_PATTERNS = [r"^\.[a-z0-9]+rc$", r"^\.[a-z0-9]+_profile$"]
RESERVED_DOTFILES = [".terminfo", ".jupyter", ".ssh", ".ssh/authorized_keys", ".local", ".config"]
RESERVED_VFOLDERS = [
".terminfo",
".jupyter",
".tmux.conf",
".ssh",
"/bin",
"/boot",
"/dev",
"/etc",
"/lib",
"/lib64",
"/media",
"/mnt",
"/opt",
"/proc",
"/root",
"/run",
"/sbin",
"/srv",
"/sys",
"/tmp",
"/usr",
"/var",
"/home",
]
RESERVED_VFOLDER_PATTERNS = [re.compile(x) for x in _RESERVED_VFOLDER_PATTERNS]

# Mapping between vfolder names and their in-container paths.
VFOLDER_DSTPATHS_MAP = {
Expand Down
12 changes: 6 additions & 6 deletions src/ai/backend/manager/models/vfolder/row.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
from sqlalchemy.ext.asyncio import AsyncSession as SASession
from sqlalchemy.orm import Mapped, foreign, load_only, mapped_column, relationship, selectinload

from ai.backend.common.defs import MODEL_VFOLDER_LENGTH_LIMIT
from ai.backend.common.defs import (
MODEL_VFOLDER_LENGTH_LIMIT,
RESERVED_VFOLDER_PATTERNS,
RESERVED_VFOLDERS,
)
from ai.backend.common.identifier.vfolder import VFolderUUID
from ai.backend.common.types import (
QuotaScopeID,
Expand Down Expand Up @@ -53,11 +57,7 @@
VFolderOwnershipType,
)
from ai.backend.manager.data.vfolder.types import VFolderMountPermission as VFolderPermission
from ai.backend.manager.defs import (
RESERVED_VFOLDER_PATTERNS,
RESERVED_VFOLDERS,
is_noop_host,
)
from ai.backend.manager.defs import is_noop_host
from ai.backend.manager.errors.api import InvalidAPIParameters
from ai.backend.manager.errors.common import ObjectNotFound
from ai.backend.manager.errors.storage import (
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/manager/api/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def test_vfolder_name_validator() -> None:
assert verify_vfolder_name("/home/work/boot")
assert verify_vfolder_name("/home/work/root")
assert verify_vfolder_name("home/work")
# Mounting exactly at /home/work collides with the agent's intrinsic
# scratch mount and makes dockerd reject container creation.
assert not verify_vfolder_name("/home/work")


def test_dotfile_name_validator() -> None:
Expand Down
Loading