From 40d36b4b99b9d4f00a8b292e9ca27666f3f895ff Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Wed, 8 Jul 2026 12:56:09 +0200 Subject: [PATCH] feat(vm_provision_mixin): set agent=1 on VM create for guest-agent channel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Proxmox only opens the virtio-serial channel qemu-guest-agent needs when agent=1 is set at VM creation — without it, the agent package can be installed but never actually reachable. --- napalm_proxmox/vm_provision_mixin.py | 4 ++++ tests/test_vm_provision_mixin.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/napalm_proxmox/vm_provision_mixin.py b/napalm_proxmox/vm_provision_mixin.py index 21b9b22..ec2c76e 100644 --- a/napalm_proxmox/vm_provision_mixin.py +++ b/napalm_proxmox/vm_provision_mixin.py @@ -273,6 +273,10 @@ class ProxmoxVMProvisionMixin: cores=cpu, ostype="l26", scsihw="virtio-scsi-pci", + # Without this, Proxmox never attaches the virtio-serial + # channel the QEMU guest agent needs — get_vm_status's + # agent queries (below) would have nothing to talk to. + agent="1", ) # Step 3: Download cloud image (cached) and import as root disk diff --git a/tests/test_vm_provision_mixin.py b/tests/test_vm_provision_mixin.py index fe995f4..8581ce6 100644 --- a/tests/test_vm_provision_mixin.py +++ b/tests/test_vm_provision_mixin.py @@ -123,6 +123,11 @@ def test_create_vm_from_cloud_init_single_nic(): assert mock_node.qemu.post.called mixin._download_cloud_image.assert_called_once() + # Regression: without agent="1" Proxmox never attaches the virtio-serial + # channel the QEMU guest agent needs, so get_vm_status(wait_for_ip=True) + # can never succeed no matter what's installed inside the guest. + assert mock_node.qemu.post.call_args[1]["agent"] == "1" + # Verify NIC config was set correctly: net0 with tag=10, DHCP enabled net_call_args = next(c for c in mock_vm.config.post.call_args_list if "net0" in c[1]) assert "tag=10" in net_call_args[1]["net0"]