Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
feat: Add more fields to types.VFolderMount (#122)
Browse files Browse the repository at this point in the history
* These may be useful for searching/analyzing vfolder mounts
  • Loading branch information
achimnol authored Mar 10, 2022
1 parent 8d67988 commit 6c031bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/122.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add more fields to `types.VFolderMount` as a follow-up of #121
6 changes: 6 additions & 0 deletions src/ai/backend/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,13 +684,17 @@ def as_trafaret(cls) -> t.Trafaret:
@attr.define(slots=True)
class VFolderMount(JSONSerializableMixin):
name: str
vfid: uuid.UUID
vfsubpath: PurePosixPath
host_path: PurePosixPath
kernel_path: PurePosixPath
mount_perm: MountPermission

def to_json(self) -> dict[str, Any]:
return {
'name': self.name,
'vfid': str(self.vfid),
'vfsubpath': str(self.vfsubpath),
'host_path': str(self.host_path),
'kernel_path': str(self.kernel_path),
'mount_perm': self.mount_perm.value,
Expand All @@ -705,6 +709,8 @@ def as_trafaret(cls) -> t.Trafaret:
from . import validators as tx
return t.Dict({
t.Key('name'): t.String,
t.Key('vfid'): tx.UUID,
t.Key('vfsubpath', default="."): tx.PurePath,
t.Key('host_path'): tx.PurePath,
t.Key('kernel_path'): tx.PurePath,
t.Key('mount_perm'): tx.Enum(MountPermission),
Expand Down

0 comments on commit 6c031bb

Please sign in to comment.