|
18 | 18 | ModelHealthCheck, |
19 | 19 | ModelServiceConfig, |
20 | 20 | ) |
| 21 | +from ai.backend.common.dto.manager.session.types import MountOption as MountOptionDTO |
21 | 22 | from ai.backend.common.events.event_types.session.broadcast import SchedulingBroadcastEvent |
22 | 23 | from ai.backend.common.events.types import AbstractEvent |
23 | 24 | from ai.backend.common.plugin.hook import HookPluginContext |
|
28 | 29 | SlotName, |
29 | 30 | ) |
30 | 31 | from ai.backend.manager.config.provider import ManagerConfigProvider |
| 32 | +from ai.backend.manager.data.model_serving.types import MountOption |
31 | 33 | from ai.backend.manager.data.session.types import SessionStatus |
32 | 34 | from ai.backend.manager.errors.kernel import SessionNotFound |
33 | 35 | from ai.backend.manager.plugin.network import NetworkPluginContext |
@@ -392,3 +394,40 @@ async def _hang(cache_id: str) -> AsyncIterator[AbstractEvent]: |
392 | 394 | await mock_registry_obj._wait_for_session_running( |
393 | 395 | session_id, mock_propagator, max_wait=0 |
394 | 396 | ) |
| 397 | + |
| 398 | + |
| 399 | +class TestMountDestinationAsymmetry: |
| 400 | + """``MountOption.mount_destination`` is honored only on the inference service |
| 401 | + creation path; session creation silently drops it from ``mount_options`` and |
| 402 | + pulls destinations from ``mount_id_map`` instead. This is why the field is |
| 403 | + marked deprecated for session callers (see common/dto/manager/session/types.py). |
| 404 | + """ |
| 405 | + |
| 406 | + def test_session_creation_drops_mount_destination_from_mount_options(self) -> None: |
| 407 | + vfid = uuid.uuid4() |
| 408 | + creation_config = { |
| 409 | + "mount_ids": [vfid], |
| 410 | + "mount_id_map": {}, # caller did not provide a destination here |
| 411 | + "mount_options": { |
| 412 | + vfid: {"mount_destination": "/should/be/ignored", "permission": "ro"}, |
| 413 | + }, |
| 414 | + } |
| 415 | + |
| 416 | + entries = AgentRegistry._mount_entries_from_creation_config(creation_config) |
| 417 | + |
| 418 | + assert len(entries) == 1 |
| 419 | + # mount_destination from mount_options is silently dropped — only |
| 420 | + # mount_id_map can supply destinations for session creation. |
| 421 | + assert entries[0].mount_destination is None |
| 422 | + |
| 423 | + def test_inference_service_preserves_mount_destination_via_from_dto(self) -> None: |
| 424 | + dto = MountOptionDTO.model_validate({ |
| 425 | + "mount_destination": "/models/extra", |
| 426 | + "perm": "ro", |
| 427 | + }) |
| 428 | + |
| 429 | + data = MountOption.from_dto(dto) |
| 430 | + |
| 431 | + # Service-creation flow carries mount_destination through to the data |
| 432 | + # layer (and ultimately to VFolderMount.kernel_path). |
| 433 | + assert data.mount_destination == "/models/extra" |
0 commit comments