add restart_vm to all providers

This commit is contained in:
Dillon DuPont
2025-10-14 11:30:40 -04:00
parent cbd54fd9d6
commit 86a339d1cd
5 changed files with 20 additions and 8 deletions

View File

@@ -57,14 +57,14 @@ async def main() -> None:
# )
# # To probe a VM's status via its public hostname (if you know the name):
name = "m-linux-96lcxd2c2k"
info = await provider.get_vm(name)
print("get_vm info:\n",
f"name: {info['name']}\n",
f"status: {info['status']}\n", # running
f"api_url: {info.get('api_url')}\n",
f"os_type: {info.get('os_type')}\n",
)
# name = "m-linux-96lcxd2c2k"
# info = await provider.get_vm(name)
# print("get_vm info:\n",
# f"name: {info['name']}\n",
# f"status: {info['status']}\n", # running
# f"api_url: {info.get('api_url')}\n",
# f"os_type: {info.get('os_type')}\n",
# )
if __name__ == "__main__":
asyncio.run(main())

View File

@@ -405,6 +405,9 @@ class DockerProvider(BaseVMProvider):
"provider": "docker"
}
async def restart_vm(self, name: str, storage: Optional[str] = None) -> Dict[str, Any]:
raise NotImplementedError("DockerProvider does not support restarting VMs.")
async def update_vm(self, name: str, update_opts: Dict[str, Any], storage: Optional[str] = None) -> Dict[str, Any]:
"""Update VM configuration.

View File

@@ -486,6 +486,9 @@ class LumeProvider(BaseVMProvider):
"""Update VM configuration."""
return self._lume_api_update(name, update_opts, debug=self.verbose)
async def restart_vm(self, name: str, storage: Optional[str] = None) -> Dict[str, Any]:
raise NotImplementedError("LumeProvider does not support restarting VMs.")
async def get_ip(self, name: str, storage: Optional[str] = None, retry_delay: int = 2) -> str:
"""Get the IP address of a VM, waiting indefinitely until it's available.

View File

@@ -836,6 +836,9 @@ class LumierProvider(BaseVMProvider):
logger.error(error_msg)
return error_msg
async def restart_vm(self, name: str, storage: Optional[str] = None) -> Dict[str, Any]:
raise NotImplementedError("LumierProvider does not support restarting VMs.")
async def get_ip(self, name: str, storage: Optional[str] = None, retry_delay: int = 2) -> str:
"""Get the IP address of a VM, waiting indefinitely until it's available.

View File

@@ -390,6 +390,9 @@ class WinSandboxProvider(BaseVMProvider):
"error": "Windows Sandbox does not support runtime configuration updates. "
"Please stop and restart the sandbox with new configuration."
}
async def restart_vm(self, name: str, storage: Optional[str] = None) -> Dict[str, Any]:
raise NotImplementedError("WinSandboxProvider does not support restarting VMs.")
async def get_ip(self, name: str, storage: Optional[str] = None, retry_delay: int = 2) -> str:
"""Get the IP address of a VM, waiting indefinitely until it's available.