Api php

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";
 

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!