Dumme API Frage ;)

baldy

Active Member
Feb 9, 2017
17
4
43
41
Hi,

ich würde gerne per API einen command ausführen der eine VM entsprechend migriert auf einen anderen Host im Cluster.

Code:
/api2/json/nodes/lnx01/qemu/104/migrate/

So steht's in der Doku. Damit habe ich erst erst mal die aktuelle VM ausgewählt - Wie genau würde die URL in denn weiter aussehen müssen?
Hätte jetzt sowas in der Art erwartet:

Code:
/api2/json/nodes/lnx01/qemu/104/migrate/&target=host2

Aber natürlich geht genau das nicht ;)
 
Das migrate API ist ein PUSH request (kein GET). Das heißt die URL stimmt. Die Daten musst Du im body mitsenden.
 
Hi,

ich vertseh das trotzdem noch nicht:

Code:
- name: Migrate VM
      uri:
        url: "https://lnx01:8006/api2/json/nodes/lnx01/qemu/104/migrate"
        method: "POST"
        return_content: yes
        headers:
          content-type: "application/json"
          Authorization: "PVEAPIToken=root@pam!test=xxxxxxx"
        body:
          node: lnx01
          vmid: 104
          target: lnx02

Ich würde das gerne ins Ansible packen aber irgendwie komm ich hier einfach seid Tagen nicht weiter.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!