Add network editing with VLAN, firewall, IPv4/IPv6 and undo

Press n in the info screen to edit one interface: bridge, VLAN tag,
firewall, IPv4 (DHCP, static or none) and IPv6 (SLAAC, DHCP, static or
none). The netN string is parsed, the chosen fields are changed and
the string is written back, so hwaddr, model=MAC, mtu, rate, trunks
and type are kept. For VMs, IP settings go to cloud-init ipconfigN and
only when the VM has a cloud-init drive.

A confirm shows the old and new raw values before anything is sent.
Press u to restore the values from before the last change to that
guest in this session.

Review fixes:
- Undo entries are cleared on a context switch, because VMIDs repeat
  across clusters.
- has_cloudinit only looks at disks.
- CIDR needs a decimal prefix: no netmask form and no /0.
- Fields you did not touch are not rewritten.

Live test on CT 104: firewall, VLAN 99, IPv6 DHCP and static IPv4 were
each applied and undone, and net0 ended identical to the baseline.
Going from static back to DHCP left the CT without IPv4 until a
reboot, so the confirm now warns that IP changes on a running
container may need one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #4.
This commit is contained in:
DuckbootandClaude Opus 5.5 committed 2026-11-02 21:45:06 +01:00
1 parent b874996b1d
commit 5038148686
9 files changed
+1422 -11

No files matched your search

+5 -1
View File
@@ -10,7 +10,11 @@ dependencies = ["textual>=8.2"]
cv4pve-tui = "cv4pve_tui.app:main"
[dependency-groups]
dev = ["pytest>=8", "pytest-asyncio>=1.0"]
dev = [
"hypothesis>=6.170.14",
"pytest>=8",
"pytest-asyncio>=1.0",
]
[build-system]
requires = ["hatchling"]