summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-10-05 09:23:48 +0300
committerDevaev Maxim <[email protected]>2019-10-05 09:23:48 +0300
commite97d48b363b79a27e0956fb7e8e187066e4b8e86 (patch)
treef2cd185e9cb66d7ff3e663f7517076774daaad20
parenta073113f383bdeac7a442eae04df2ece642eae5b (diff)
cdrom flag; written fix
-rw-r--r--kvmd/apps/kvmd/server.py4
-rw-r--r--kvmd/plugins/msd/__init__.py2
-rw-r--r--kvmd/plugins/msd/disabled.py5
-rw-r--r--kvmd/plugins/msd/otg.py5
-rw-r--r--kvmd/plugins/msd/relay.py3
5 files changed, 12 insertions, 7 deletions
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py
index 81f2c0b4..04030545 100644
--- a/kvmd/apps/kvmd/server.py
+++ b/kvmd/apps/kvmd/server.py
@@ -481,7 +481,9 @@ class Server: # pylint: disable=too-many-instance-attributes
@_exposed("POST", "/msd/select")
async def __msd_select_handler(self, request: aiohttp.web.Request) -> aiohttp.web.Response:
- return _json(await self.__msd.select(valid_msd_image_name(request.query.get("image_name"))))
+ image_name = valid_msd_image_name(request.query.get("image_name"))
+ cdrom = valid_bool(request.query.get("cdrom", "true"))
+ return _json(await self.__msd.select(image_name, cdrom))
@_exposed("POST", "/msd/remove")
async def __msd_remove_handler(self, request: aiohttp.web.Request) -> aiohttp.web.Response:
diff --git a/kvmd/plugins/msd/__init__.py b/kvmd/plugins/msd/__init__.py
index bff60232..dc6fbd51 100644
--- a/kvmd/plugins/msd/__init__.py
+++ b/kvmd/plugins/msd/__init__.py
@@ -92,7 +92,7 @@ class BaseMsd(BasePlugin):
async def disconnect(self) -> Dict:
raise NotImplementedError
- async def select(self, name: str) -> Dict:
+ async def select(self, name: str, cdrom: bool) -> Dict:
raise NotImplementedError
async def remove(self, name: str) -> Dict:
diff --git a/kvmd/plugins/msd/disabled.py b/kvmd/plugins/msd/disabled.py
index 5eb3083b..eafbdd65 100644
--- a/kvmd/plugins/msd/disabled.py
+++ b/kvmd/plugins/msd/disabled.py
@@ -46,9 +46,10 @@ class Plugin(BaseMsd):
"online": False,
"busy": False,
"uploading": False,
- "written": False,
+ "written": 0,
"current": None,
"storage": None,
+ "cdrom": None,
"connected": False,
}
@@ -68,7 +69,7 @@ class Plugin(BaseMsd):
async def disconnect(self) -> Dict:
raise MsdDisabledError()
- async def select(self, name: str) -> Dict:
+ async def select(self, name: str, cdrom: bool) -> Dict:
raise MsdDisabledError()
async def remove(self, name: str) -> Dict:
diff --git a/kvmd/plugins/msd/otg.py b/kvmd/plugins/msd/otg.py
index 70bb3f05..db1c2254 100644
--- a/kvmd/plugins/msd/otg.py
+++ b/kvmd/plugins/msd/otg.py
@@ -46,9 +46,10 @@ class Plugin(BaseMsd):
"online": False,
"busy": False,
"uploading": False,
- "written": False,
+ "written": 0,
"current": None,
"storage": None,
+ "cdrom": None,
"connected": False,
}
@@ -68,7 +69,7 @@ class Plugin(BaseMsd):
async def disconnect(self) -> Dict:
raise MsdCliOnlyError()
- async def select(self, name: str) -> Dict:
+ async def select(self, name: str, cdrom: bool) -> Dict:
raise MsdCliOnlyError()
async def remove(self, name: str) -> Dict:
diff --git a/kvmd/plugins/msd/relay.py b/kvmd/plugins/msd/relay.py
index d53e0720..926d6526 100644
--- a/kvmd/plugins/msd/relay.py
+++ b/kvmd/plugins/msd/relay.py
@@ -228,6 +228,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
"written": self.__written,
"current": current,
"storage": storage,
+ "cdrom": None,
"connected": (not self.__on_kvm),
}
@@ -317,7 +318,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
await self.__state_queue.put(state or self.get_state())
@_msd_working
- async def select(self, name: str) -> Dict:
+ async def select(self, name: str, cdrom: bool) -> Dict:
raise MsdMultiNotSupported()
@_msd_working