From: Lucas Barros <lucasbarros.kam@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Lucas Barros <lucasbarros.kam@gmail.com>
Subject: [PATCH qemu-server/container/manager v2 0/5] fix #7173: do not keep an empty tag list in guest configs
Date: Sun, 15 Nov 2026 22:00:35 -0300 [thread overview]
Message-ID: <20261116010040.90964-1-lucasbarros.kam@gmail.com> (raw)
In-Reply-To: <1794390075.ol4qipttrq.astroid@yuna.none>
Removing the last tag of a guest leaves an empty 'tags:' line in its
config, which the API returns as a tag list with a single space.
v1 dropped the empty value when writing the config. Fabian found that
hacky [0] and suggested to delete the option instead and to make the
parser ignore it. v2 does that:
* 1/5, 3/5: the update API turns an empty tag list (checked with
split_list(), so delimiters only count as empty too) into a deletion
* 2/5, 4/5: the parsers skip an empty 'tags' line, so old configs read
as having no tags and lose the line on the next write
* 5/5: the web UI sends 'delete: tags' when the last tag is removed
I first made the parsers skip every key without a value, but that is
not safe in general:
* 'boot: ' means that no device gets a boot index, while no 'boot' at
all means the default order. The cfg2cmd test bootorder-empty.conf
fails with that change.
* in qemu-server, update_vm_api() reloads the config between writing a
pending change and applying it, so 'qm set --searchdomain ""' on a
stopped VM was silently lost.
So 2/5 and 4/5 only handle 'tags'. Making empty list parameters invalid
for 10.0 is not part of this series.
Tested on a PVE 9 node (qemu-server 9.2.15, pve-container 6.1.18, the
.pm files patched in place):
removing the last tag (VM and CT, via 'tags=' as the UI sends today)
before: 'tags: ' line in the config, API returns "tags":" "
after: no line, API returns no tags
--tags ';,' same as above
existing 'tags: ' / 'tags:' before: " " / "unable to parse config"
after: no tags, line gone on next write
'tags: a;b', running VM, '--tags "" --delete tags' unchanged
'boot: ', '--searchdomain ""' unchanged
qemu-server 'make test' (with 16 CPUs in /proc/cpuinfo): 280 ok before,
282 after, the new parse-config case fails without 2/5. pve-container
'make test' passes before and after, the new subtest fails without 4/5.
proxmox-perltidy and proxmox-biome report no changes.
v1:
https://lore.proxmox.com/pve-devel/20261109135613.94692-1-lucasbarros.kam@gmail.com/
https://lore.proxmox.com/pve-devel/20261109135640.94964-1-lucasbarros.kam@gmail.com/
[0] https://lore.proxmox.com/pve-devel/1794390075.ol4qipttrq.astroid@yuna.none/
This series was prepared with the help of an LLM based coding
assistant; I reviewed the changes and ran the tests mentioned above
myself.
qemu-server:
Lucas Barros (2):
fix #7173: api: update: delete tags when an empty tag list is set
config: ignore an empty tag list when parsing
src/PVE/API2/Qemu.pm | 9 +++++++++
src/PVE/QemuServer.pm | 3 +++
src/test/parse-config-expected/empty-tags.conf | 11 +++++++++++
src/test/parse-config-input/empty-tags.conf | 12 ++++++++++++
src/test/run_parse_config_tests.pl | 2 +-
5 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 src/test/parse-config-expected/empty-tags.conf
create mode 100644 src/test/parse-config-input/empty-tags.conf
container:
Lucas Barros (2):
fix #7173: api: update: delete tags when an empty tag list is set
config: ignore an empty tag list when parsing
src/PVE/API2/LXC/Config.pm | 9 +++++++++
src/PVE/LXC/Config.pm | 3 +++
src/test/config_tests.pl | 21 +++++++++++++++++++++
3 files changed, 33 insertions(+)
manager:
Lucas Barros (1):
fix #7173: ui: guest: delete tags when removing the last tag
www/manager6/lxc/Config.js | 4 +---
www/manager6/qemu/Config.js | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
Summary over all repositories:
10 files changed, 71 insertions(+), 7 deletions(-)
next prev parent reply other threads:[~2026-11-16 1:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 13:56 [PATCH qemu-server] fix #7173: config: do not write out an empty tag list Lucas Barros
2026-11-11 9:53 ` Fabian Grünbichler
2026-11-16 1:00 ` Lucas Barros [this message]
2026-11-16 1:00 ` [PATCH qemu-server v2 1/5] fix #7173: api: update: delete tags when an empty tag list is set Lucas Barros
2026-11-16 1:00 ` [PATCH qemu-server v2 2/5] config: ignore an empty tag list when parsing Lucas Barros
2026-11-16 1:00 ` [PATCH container v2 3/5] fix #7173: api: update: delete tags when an empty tag list is set Lucas Barros
2026-11-16 1:00 ` [PATCH container v2 4/5] config: ignore an empty tag list when parsing Lucas Barros
2026-11-16 1:00 ` [PATCH manager v2 5/5] fix #7173: ui: guest: delete tags when removing the last tag Lucas Barros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116010040.90964-1-lucasbarros.kam@gmail.com \
--to=lucasbarros.kam@gmail.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.