mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
MSD 支持运行目录存放镜像
This commit is contained in:
@@ -53,7 +53,7 @@ class Drive:
|
||||
# =====
|
||||
|
||||
def set_image_path(self, path: str) -> None:
|
||||
if path:
|
||||
if path or not self.__has_param("forced_eject"):
|
||||
self.__set_param("file", path)
|
||||
else:
|
||||
self.__set_param("forced_eject", "")
|
||||
@@ -75,7 +75,9 @@ class Drive:
|
||||
return (not int(self.__get_param("ro")))
|
||||
|
||||
# =====
|
||||
|
||||
def __has_param(self, param: str) -> bool:
|
||||
return os.access(os.path.join(self.__lun_path, param), os.F_OK)
|
||||
|
||||
def __get_param(self, param: str) -> str:
|
||||
with open(os.path.join(self.__lun_path, param)) as file:
|
||||
return file.read().strip()
|
||||
|
||||
Reference in New Issue
Block a user