summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmd/kvmd/msd.py16
-rw-r--r--kvmd/kvmd/server.py10
2 files changed, 13 insertions, 13 deletions
diff --git a/kvmd/kvmd/msd.py b/kvmd/kvmd/msd.py
index 4f750193..a67db27b 100644
--- a/kvmd/kvmd/msd.py
+++ b/kvmd/kvmd/msd.py
@@ -176,7 +176,7 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
self.__device_info: Optional[_MassStorageDeviceInfo] = None
self._lock = asyncio.Lock()
self._device_file: Optional[aiofiles.base.AiofilesContextManager] = None
- self.__writed = 0
+ self.__written = 0
logger = get_logger(0)
if self._device_path:
@@ -221,7 +221,7 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
"in_operate": bool(self._device_path),
"connected_to": ("kvm" if self.__device_info else "server"),
"busy": bool(self._device_file),
- "writed": self.__writed,
+ "written": self.__written,
"info": info,
}
@@ -235,7 +235,7 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
if not self.__device_info:
raise IsNotConnectedToKvmError()
self._device_file = await aiofiles.open(self.__device_info.path, mode="w+b", buffering=0)
- self.__writed = 0
+ self.__written = 0
return self
async def write_image_info(self, name: str, complete: bool) -> None:
@@ -243,9 +243,9 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
assert self._device_file
assert self.__device_info
if self.__write_meta:
- if self.__device_info.size - self.__writed > _IMAGE_INFO_SIZE:
+ if self.__device_info.size - self.__written > _IMAGE_INFO_SIZE:
await self._device_file.seek(self.__device_info.size - _IMAGE_INFO_SIZE)
- await self.__write_to_device_file(_make_image_info_bytes(name, self.__writed, complete))
+ await self.__write_to_device_file(_make_image_info_bytes(name, self.__written, complete))
await self._device_file.seek(0)
await self.__load_device_info()
else:
@@ -254,8 +254,8 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
async def write_image_chunk(self, chunk: bytes) -> int:
async with self._lock:
await self.__write_to_device_file(chunk)
- self.__writed += len(chunk)
- return self.__writed
+ self.__written += len(chunk)
+ return self.__written
async def __aexit__(
self,
@@ -287,4 +287,4 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
get_logger().exception("Can't close mass-storage device file")
# TODO: reset device file
self._device_file = None
- self.__writed = 0
+ self.__written = 0
diff --git a/kvmd/kvmd/server.py b/kvmd/kvmd/server.py
index 4574efd5..a49762d1 100644
--- a/kvmd/kvmd/server.py
+++ b/kvmd/kvmd/server.py
@@ -170,7 +170,7 @@ class Server: # pylint: disable=too-many-instance-attributes
async def __msd_write_handler(self, request: aiohttp.web.Request) -> aiohttp.web.Response:
logger = get_logger(0)
reader = await request.multipart()
- writed = 0
+ written = 0
try:
field = await reader.next()
if not field or field.name != "image_name":
@@ -189,13 +189,13 @@ class Server: # pylint: disable=too-many-instance-attributes
chunk = await field.read_chunk(self.__msd_chunk_size)
if not chunk:
break
- writed = await self.__msd.write_image_chunk(chunk)
+ written = await self.__msd.write_image_chunk(chunk)
await self.__msd.write_image_info(image_name, True)
await self.__broadcast_event("msd_state", state="free") # type: ignore
finally:
- if writed != 0:
- logger.info("Writed %d bytes to mass-storage device", writed)
- return _json_200({"writed": writed})
+ if written != 0:
+ logger.info("written %d bytes to mass-storage device", written)
+ return _json_200({"written": written})
async def __streamer_state_handler(self, _: aiohttp.web.Request) -> aiohttp.web.Response:
return _json_200(self.__streamer.get_state())