From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id E1FC11FF066 for ; Tue, 24 Nov 2026 22:27:06 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id DA18721690; Tue, 24 Nov 2026 22:26:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sfc.wide.ad.jp; s=mail2; t=1795555592; bh=a5QVvccX+6ZdPZAnZHYzWIX5WVNUM3NuYGNo3GmfQVQ=; h=From:To:Subject:Date:From; b=yV3JP8ZoQ/x5bVSJ9a3t2+1QiPK+b1651Wpe4JqaOB+8j9AAIhlaGrSIzlzs2KaAk uCGnDrqEQsU6vklj7Gyje6/kGUBDky0BLQDcPKY41xpEqjsfFhzVw63KC4M9KCxJkA Ti1BkINrFc/Ga0yk1k4Fg4amey19osHmhxEiWyS7krOeOYJrvxFZWeHWnn/SZNl0lj ltTk3NVHe7MH+Kt8ToloKjIyymerQbCmCjQKWqfFt38F+Zmf95MLhlN1kIYJ00FlVA +JFkXlCPRHjVyfhGMMma0+b8CiiWK6PkbN58twENWf1cF0fJOf1xW/3AjvdJFcK7iq 6roW9ZoFjDU1A== From: negineri To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server/pve-manager 0/2] fix #7100: allow disabling cloud-init /etc/hosts management Date: Wed, 25 Nov 2026 06:26:06 +0900 Message-ID: <20261124212608.12996-1-negineri@sfc.wide.ad.jp> X-Mailer: git-send-email 2.56.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: DC72QI3CG6NR5AWRAGA5XJI4V7BEEFWZ X-Message-ID-Hash: DC72QI3CG6NR5AWRAGA5XJI4V7BEEFWZ X-MailFrom: negineri@sfc.wide.ad.jp X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Proxmox VE writes manage_etc_hosts: true in its generated cloud-init user data. This can overwrite /etc/hosts during provisioning, before a guest administrator has a chance to configure it. Bug #7100 asks for a way to opt out through the GUI or API before first boot, without supplying a custom user-data file: https://bugzilla.proxmox.com/show_bug.cgi?id=7100 The series adds the per-VM boolean cimanagehosts. It defaults to enabled to preserve existing VM behavior. For a VM with a cloud-init disk, set it to 0 before boot and regenerate the image: qm set --cimanagehosts 0 qm cloudinit update This writes manage_etc_hosts: false explicitly. Deleting the option restores the default. Custom user data continues to take precedence. Apply the qemu-server patch first. It registers the option, requires VM.Config.Cloudinit to change it, and reports zero correctly in the cloud-init image diff. The pve-manager patch then exposes the option in the Cloud-Init panel, with the same permission for editing and removal. On a Debian 13 test VM with qemu-server 9.2.22 and pve-manager 9.2.38, the generated NoCloud and ConfigDrive2 images contained the expected values. A nested Debian guest with cloud-init 25.1.4 kept a manual /etc/hosts entry across a reboot with the option disabled. After it was enabled and the image regenerated, cloud-init replaced the file using its template. I also compared the image diff transitions and checked the Edit and Remove buttons under Cloudinit, Audit and Network roles in Chrome. On the rebased series (qemu-server base 6a0c35f5 and pve-manager base 75610602), both packages built with make deb and tests enabled. The qemu-server API and cloud-init tests passed, including the five new image diff cases, and pve-manager passed make -C www check. I used an AI coding assistant to prepare and test these changes. qemu-server src/PVE/API2/Qemu.pm | 9 ++--- src/PVE/QemuServer.pm | 6 ++++ src/PVE/QemuServer/Cloudinit.pm | 3 +- src/test/run_api_cloudinit_dump_tests.pl | 42 ++++++++++++++++++++++++ pve-manager www/manager6/qemu/CloudInit.js | 22 ++++++++++++++++++++++ 5 files changed, 77 insertions(+), 5 deletions(-) in total