- Introduced a standalone guest execution agent to facilitate command execution within the guest VM over Firecracker's vsock. - Enhanced FirecrackerClient to support vsock configuration, validating guest CID and UDS path. - Updated configuration to include vsock settings by default. - Refactored FirecrackerProcessManager to manage runtime sockets more effectively. - Implemented guest agent installation and provisioning in the image store. - Added API endpoints for executing commands in the VM and installing the guest agent. - Improved error handling for guest execution failures and agent availability.
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
"""Application-specific failures with predictable command-line handling."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
class UvmError(Exception):
|
|
"""An expected error that should be rendered without a traceback."""
|
|
|
|
def __init__(self, message: str, exit_code: int = 1) -> None:
|
|
super().__init__(message)
|
|
self.exit_code = exit_code
|
|
|
|
|
|
class ConfigurationError(UvmError):
|
|
"""Raised when local uvm configuration is invalid."""
|
|
|
|
|
|
class ValidationError(UvmError):
|
|
"""Raised when a command argument is invalid."""
|
|
|
|
|
|
class StateError(UvmError):
|
|
"""Raised when persisted VM state cannot be safely used."""
|
|
|
|
|
|
class NotFoundError(UvmError):
|
|
"""A requested registry entry does not exist."""
|
|
|
|
|
|
class ConflictError(UvmError):
|
|
"""An allocation or pending operation prevents the requested action."""
|
|
|
|
|
|
class CommandError(UvmError):
|
|
"""Raised when a required host command cannot be executed successfully."""
|
|
|
|
|
|
class FirecrackerError(UvmError):
|
|
"""Raised when Firecracker cannot be started or configured."""
|
|
|
|
|
|
class GuestAgentUnavailableError(UvmError):
|
|
"""The VM's execution agent could not be reached before submission."""
|
|
|
|
|
|
class GuestExecutionError(UvmError):
|
|
"""Guest execution failed; a lost response does not prove the command failed."""
|
|
|
|
def __init__(self, message: str, *, outcome_unknown: bool = False) -> None:
|
|
super().__init__(message)
|
|
self.outcome_unknown = outcome_unknown
|
|
|
|
|
|
class TapCreationError(UvmError):
|
|
"""Raised when TAP setup fails after creating a host interface."""
|
|
|
|
def __init__(self, message: str, *, tap_created: bool) -> None:
|
|
super().__init__(message)
|
|
self.tap_created = tap_created
|