mirror of
https://github.com/trycua/computer.git
synced 2026-01-06 13:30:06 -06:00
add restart_vm to all providers
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user