Api php

  • Thread starter Thread starter philip65
  • Start date Start date
P

philip65

Guest
Hi,

I have a little problem whith the Proxmox API.

My goal is to change whith a php page the MAC address of one KVM.

My code :

Code:
if ($pve2->constructor_success()) {    
if ($pve2->login()) {
            $settings = array();
            $settings['skiplock'] = true;
            $settings['net[0]'] = "e1000='".$MY_MAC_ADDRESS."'[,vmbr0]";
            $pve2->put("/nodes/$nodename/qemu/$vmid/config", $settings);
    } else {
       echo("Impossible d'effectuer le changement.");
    }
}

But when I execute this code, in Proxmox Cluster Task History, the login is show but not the update of the Network Adaptater.
I have tried to change RAM (with memory argument) and it succesfull ! Why the MAC Address not ?

Thank's for your help.

PS: Sorry for my bad English, I'm French
 
Last edited by a moderator:
Bonjour,
et merci pour votre réponse.

le format de ma requête est bien celui que vous m'avez donné, cependant, cela ne marche pas.

Qui développe l'API Php ?

Merci, d'avance.
 
I appreciate all input, but this is an English forum only, so no French please.
 
Code:
$settings['net[0]'] = "e1000='".$MY_MAC_ADDRESS."'[,vmbr0]";

NB: I know this is 5 month old posting but I'm currently making PHP module, so I can share my experience.

I've tested the PHP API has no issue. Your code should be:
Code:
$settings['net0'] = "e1000='" . $MY_MAC_ADDRESS . "',bridge=vmbr0";