From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 4C6521FF0E1 for ; Mon, 16 Nov 2026 02:01:29 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id DE40E21743; Mon, 16 Nov 2026 02:01:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794790848; x=1795395648; darn=lists.proxmox.com; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=mwSE+PEEm3NQIjgKVBHxEfqxzsC2meHOApTmagGRsIE=; b=Q9atu6dyu9qo5+hCGtUkeKhhHr5sAHDb2sn9T9gIEto6yQnC3BQzBmIc2Meb4yD6q7 DEhGyiXrK7jI1jZorHPxIWFrArX/GI++xTQepL+FkysxruSD1WYGnOX+olrq+5T9iM1I yOIbPZ884wemYBYqD8dhna7x/P4cqDXWSWO0ruacVUa8SCJ2+FHwPL6EdbebjKNU0xdr +5+UUlATi/WI7W5B69+UwHu3ew73L5ndhKJpnlnlHHz/3KAW7RnzJrU+NFFVc15okhC6 34IwN00s/FTvgPiOWMuE4c+5oglObiLSbk6aI60HNF31MU7UD18FU7Bw7YJ1/0iUFUgY 1zXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794790848; x=1795395648; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mwSE+PEEm3NQIjgKVBHxEfqxzsC2meHOApTmagGRsIE=; b=U0Rej80tw39fsDLM1G/rf/o58oRLiHjA8Mc7ynalTacuSYFklWzmqM8iNfvXHsYDan 7TUTK+zVvXaflba2tE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fupBAQc92cibguZvkQOLEoTOlaLgmdVfi09JsVgon X-Received: by 2002:a05:6102:605c:b0:7d2:7dcd:7c99 with SMTP id ada2fe7eead31-7d64d6fe33cmr2086317137.7.1794790847429; Sun, 15 Nov 2026 17:00:47 -0800 (PST) From: Lucas Barros To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 1/5] fix #7173: api: update: delete tags when an empty tag list is set Date: Sun, 15 Nov 2026 22:00:36 -0300 Message-ID: <20261116010040.90964-2-lucasbarros.kam@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261116010040.90964-1-lucasbarros.kam@gmail.com> References: <1794390075.ol4qipttrq.astroid@yuna.none> <20261116010040.90964-1-lucasbarros.kam@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.075 Adjusted score from AWL reputation of From: address 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 FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust 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: OQJQ7BFU42OJ75DXWNY7BIFS6LPG4FY5 X-Message-ID-Hash: OQJQ7BFU42OJ75DXWNY7BIFS6LPG4FY5 X-MailFrom: lucasbarros.kam@gmail.com 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 CC: Lucas Barros X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Setting 'tags' to an empty string, as the web UI does when removing the last tag of a VM, stores the empty value in the config and leaves an empty 'tags:' line behind, instead of removing the option. Handle an empty tag list like a deletion of 'tags', so that the option goes through the regular delete path, including the tag permission checks, and nothing is left in the config. Use split_list() to decide whether the list is empty, so a value consisting only of delimiters is handled the same way. Suggested-by: Fabian Grünbichler Signed-off-by: Lucas Barros --- changes since v1: * new patch: turn an empty tag list into 'delete tags' in the API, instead of dropping it when writing the config (v1) This patch was prepared with the help of an LLM based coding assistant; I reviewed the change and ran the tests mentioned in the cover letter myself. src/PVE/API2/Qemu.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm index 7830d09b..bb3f1fdd 100644 --- a/src/PVE/API2/Qemu.pm +++ b/src/PVE/API2/Qemu.pm @@ -2191,6 +2191,15 @@ my $update_vm_api = sub { push @delete, $opt; } + # an empty tag list means no tags, so remove the option instead of setting an empty value + if (defined($param->{tags})) { + my @tags = PVE::Tools::split_list($param->{tags}); + if (!scalar(@tags)) { + delete $param->{tags}; + push @delete, 'tags'; + } + } + my $repl_conf = PVE::ReplicationConfig->new(); my $is_replicated = $repl_conf->check_for_existing_jobs($vmid, 1); my $check_replication = sub { -- 2.50.1 (Apple Git-155)