1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-25 23:21:41 +03:00

Updated proxmox so reset invokes reset instead of stop vm

This commit is contained in:
Adolfo Gómez García 2020-11-25 18:37:40 +01:00
parent 4866b8947c
commit a70e7a269b
4 changed files with 12 additions and 2 deletions

View File

@ -394,10 +394,14 @@ class ProxmoxClient:
@ensureConected
def stopVm(self, vmId: int, node: typing.Optional[str] = None) -> types.UPID:
# if exitstatus is "OK" or contains "already running", all is fine
node = node or self.getVmInfo(vmId).node
return types.UPID.fromDict(self._post('nodes/{}/qemu/{}/status/stop'.format(node, vmId)))
@ensureConected
def resetVm(self, vmId: int, node: typing.Optional[str] = None) -> types.UPID:
node = node or self.getVmInfo(vmId).node
return types.UPID.fromDict(self._post('nodes/{}/qemu/{}/status/reset'.format(node, vmId)))
@ensureConected
def suspendVm(self, vmId: int, node: typing.Optional[str] = None) -> types.UPID:
# if exitstatus is "OK" or contains "already running", all is fine

View File

@ -167,7 +167,7 @@ class ProxmoxDeployment(services.UserDeployment):
o Proxmox, reset operation just shutdowns it until v3 support is removed
"""
if self._vmid != '':
self.service().stopMachine(int(self._vmid))
self.service().resetMachine(int(self._vmid))
def getConsoleConnection(self) -> typing.Optional[typing.MutableMapping[str, typing.Any]]:
return self.service().getConsoleConnection(self._vmid)

View File

@ -143,6 +143,9 @@ class ProxmoxProvider(services.ServiceProvider): # pylint: disable=too-many-pub
def stopMachine(self, vmId: int) -> client.types.UPID:
return self.__getApi().stopVm(vmId)
def resetMachine(self, vmId: int) -> client.types.UPID:
return self.__getApi().resetVm(vmId)
def suspendMachine(self, vmId: int) -> client.types.UPID:
return self.__getApi().suspendVm(vmId)

View File

@ -242,6 +242,9 @@ class ProxmoxLinkedService(Service): # pylint: disable=too-many-public-methods
def stopMachine(self, vmId: int) -> 'client.types.UPID':
return self.parent().stopMachine(vmId)
def resetMachine(self, vmId: int) -> 'client.types.UPID':
return self.parent().resetMachine(vmId)
def suspendMachine(self, vmId: int) -> 'client.types.UPID':
return self.parent().suspendMachine(vmId)