From b7c4cc270cec58f6efdbbbf76fe79b51331df2ae Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 3 Oct 2026 22:07:31 +0800 Subject: [PATCH] fix: preserve public pool identity on VM create --- engine/virsh_panel/libvirt_service.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/virsh_panel/libvirt_service.py b/engine/virsh_panel/libvirt_service.py index 5e552706..835c2513 100644 --- a/engine/virsh_panel/libvirt_service.py +++ b/engine/virsh_panel/libvirt_service.py @@ -2260,6 +2260,13 @@ class VMService: and (not isinstance(public_pool_key, str) or not PUBLIC_POOL_KEY_RE.fullmatch(public_pool_key))): raise VMError("公网地址池标识无效", 422) + # _validate_common_create intentionally returns a narrow, validated + # create spec. Carry the already-validated pool identity forward to + # the XML builder; dropping it here leaves the guest without + # public-pool-key metadata and makes PHP reject the successful create + # during its reservation reconciliation. + if isinstance(public_pool_key, str) and public_pool_key: + validated["public_pool_key"] = public_pool_key with _CREATE_LOCK, self._connect() as conn: self._require_clean_traffic_filter(conn)