增加快速文件互传功能(基于 MSD)

为 MSD 路径添加配置选项
为 文件镜像名称添加配置选项
修复 make 测试环境
This commit is contained in:
mofeng-git
2024-11-22 17:40:55 +00:00
parent 5450d7297c
commit b8ddf7c2da
14 changed files with 262 additions and 36 deletions

View File

@@ -37,8 +37,8 @@ class Partition:
# =====
def find_msd() -> Partition:
return _find_single("otgmsd")
def find_msd(msd_directory_path) -> Partition:
return _find_single("otgmsd", msd_directory_path)
def find_pst() -> Partition:
@@ -46,12 +46,12 @@ def find_pst() -> Partition:
# =====
def _find_single(part_type: str) -> Partition:
def _find_single(part_type: str, msd_directory_path: str) -> Partition:
parts = _find_partitions(part_type, True)
if len(parts) == 0:
if os.path.exists('/var/lib/kvmd/msd'):
if os.path.exists(msd_directory_path):
#set default value
parts = [Partition(mount_path='/var/lib/kvmd/msd', root_path='/var/lib/kvmd/msd',group='kvmd', user='kvmd')]
parts = [Partition(mount_path = msd_directory_path, root_path = msd_directory_path, group = 'kvmd', user = 'kvmd')]
else:
raise RuntimeError(f"Can't find {part_type!r} mountpoint")
return parts[0]