Configure vlan using Proxmox API

tibby

New Member
Apr 3, 2018
4
0
1
36
Hello! I've been searching for an information how could I possibly configure VLAN using Proxmox API. I know how to check the network config using an API, but is it possible to add a VLAN using API?

Normally I would edit /etc/network/interfaces, but I need to do it in Python's code. Thanks.
 
Hi,

Do you like to configure VLAN for the host or for the Guests?
 
Both. Also, I would like to configure it like I do in /etc/network/interfaces. So basically, I would like to do the same thing like in /etc/network/interfaces but programatically using an API in Python.
 
We have no API VLAN configuration call for the host network.
 
You can use the set command but you have to set all nic property again.

The workflow would
GET /api2/json/nodes/{node}/qemu/{vmid}/config to fetch the current vnic config
PUT /api2/json/nodes/{node}/qemu/{vmid}/config to update the new vnic config with vlan tag.

https://pve.proxmox.com/pve-docs/api-viewer/index.html
 
Ok but you gave me the VLAN configuration for the VM. However, I would like to create only a VLAN (I know how to set VLAN for VM).