Skip to content

Commit

Permalink
Fix: Minor code fixes and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
hoh committed Aug 25, 2023
1 parent f1c0427 commit 68a45de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions firecracker/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class MicroVMFailedInit(Exception):

# extend the json.JSONEncoder class to support bytes
class JSONBytesEncoder(json.JSONEncoder):

# overload method default
def default(self, obj):
# Match all the types you want to handle in your converter
Expand Down Expand Up @@ -77,7 +76,7 @@ class MicroVM:
proc: Optional[asyncio.subprocess.Process] = None
stdout_task: Optional[Task] = None
stderr_task: Optional[Task] = None
log_queues: List
log_queues: List[asyncio.Queue]
config_file_path: Optional[Path] = None
drives: List[Drive]
init_timeout: float
Expand Down Expand Up @@ -160,7 +159,6 @@ async def start(self, config: FirecrackerConfig) -> asyncio.subprocess.Process:
async def start_firecracker(
self, config: FirecrackerConfig
) -> asyncio.subprocess.Process:

if os.path.exists(VSOCK_PATH):
os.remove(VSOCK_PATH)
if os.path.exists(self.socket_path):
Expand Down
2 changes: 1 addition & 1 deletion vm_supervisor/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
DEVICE_MAPPER_DIRECTORY = "/dev/mapper"


class NotEnoughDiskSpace(Exception):
class NotEnoughDiskSpace(OSError):
pass


Expand Down
4 changes: 3 additions & 1 deletion vm_supervisor/views/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ async def stream_logs(request: web.Request):

@require_jwk_authentication
async def operate_expire(request: web.Request):
"""Stop the virtual machine, smoothly if possible."""
"""Stop the virtual machine, smoothly if possible.
A timeout may be specified to delay the action."""
# TODO: Add user authentication
vm_hash = get_itemhash_or_400(request.match_info)
timeout = float(ItemHash(request.match_info["timeout"]))
Expand Down

0 comments on commit 68a45de

Please sign in to comment.