- Introduced a new method `installed_kernel` in `ImageStore` to handle kernel verification and checksum validation. - Updated `Installer` to include additional packages: `nftables` and `conntrack`. - Refined `LifecycleService` to improve error handling and state management during VM creation, starting, stopping, and deletion. - Enhanced port management with new methods for setting and syncing ports, including validation for port rules. - Improved error handling in `StateStore` to raise specific `NotFoundError` and `ConflictError` exceptions. - Updated network management to ensure proper TAP device handling and firewall integration. - Enhanced API responses in `vms.py` to include policy status for better client-side handling. - Added validation for VM names and ports in `validation.py` to enforce stricter rules and prevent conflicts.
48 lines
1.3 KiB
Python
48 lines
1.3 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 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
|