mirror of
https://github.com/Corsinvest/cv4pve-api-powershell.git
synced 2026-04-25 12:15:48 +03:00
[GH-ISSUE #21] Add Nic during the creation of an LXC #18
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cv4pve-api-powershell#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @J-Corentin on GitHub (Sep 9, 2024).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-powershell/issues/21
What happened?
I would like to add a network card when creating an LXC. For this, I based myself on the configuration of an existing container with the following configuration:
net0 : name=eth0,bridge=vmbr0,hwaddr=BC:24:11:4C:93:0B,ip=dhcp,ip6=dhcp,type=veth
I saw in a post that we should use a certain format with Hashtables. So, I converted the configuration to the required format:
$networkConfig = @{ 1 = "name%3Deth0%2Cbridge%3Dvmbr0%2Chwaddr%3DBC:24:11:4C:93:0B%2Cip%3Ddhcp%2Cip6%3Ddhcp%2Ctype%3Dveth" }
However, I get a 400 error when creating the machine. The creation works fine without adding the network card.
I also tried the following format:
$networkConfig = @{ 1 = [uri]::EscapeDataString("name=eth0,bridge=vmbr0,hwaddr=BC:24:11:4C:93:0B,ip=dhcp,ip6=dhcp,type=veth") }
Without any more success
So, I wanted to know what the correct format to use is, as well as the supported arguments for adding a network card when creating an LXC.
Expected behavior
Being able to add a network card during the creation of an LXC
Relevant log output
No response
Proxmox VE Version
8.2.4
Version (bug)
8.2.2
Version (working)
No response
On what operating system are you experiencing the issue?
Windows
Pull Request
@SoarinFerret commented on GitHub (Sep 10, 2024):
It needs to be provided as a string. Here is an example:
@SoarinFerret commented on GitHub (Sep 10, 2024):
A good place to find the way the parameters should be provided is this link here: https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/lxc
@J-Corentin commented on GitHub (Sep 10, 2024):
Thank you very much for the response. It works perfectly with the format :
I will also read the documentation.