benötigte api funktion für unlock vm

dfk1976

Active Member
Jan 5, 2020
19
2
43
48
es kommt manchmal vor, dass ein server per api nicht ausgeschaltet werden kann, da dieser im locked zustand ist. nun muss man manuell qm unlock <vmid> auf dem proxmox host machen. kann diese funktion in api implementiert werden, so dass man hierüber erfahren kann, ob die vm in einem locked zustand ist und in diesem fall der unlock api call durchgeführt wird?

was mir stattdessen einfällt wäre soetwas:

PHP:
<?php
$output=null;
$retval=null;

exec('sshpass -p <password> ssh <user>@<pvehostname> qm unlock <vmid>', $output, $retval);

echo "Returned with status $retval and output:\n";
print_r($output);
?>
 
Last edited:
  • Like
Reactions: Der Harry
danke. ich habe die beiden parameter nun vor jedem shutdown call hinzugefügt.

allerdings macht mich das noch etwas stutzig - (but only as root@pam)
https://forum.proxmox.com/threads/unlocking-vm-via-api-still-not-possible.73432/post-327919
passing 'delete=lock' and 'skiplock=1' to the PUT/POST config API endpoint should do the trick (but only as root@pam)

ich nutze die api mit ticket or token based authentication, eventuell ist hier kein root@pam erforderlich.
 
Last edited: