Skip to content

Commit 48b34d4

Browse files
authored
fix(add-iptag): use qm set for VM tags to handle snapshot sections correctly (#14713)
1 parent 54e13bc commit 48b34d4

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

tools/pve/add-iptag.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -811,13 +811,7 @@ update_tags() {
811811
if [[ "$type" == "lxc" ]]; then
812812
pct set "${vmid}" -tags "$(IFS=';'; echo "${next_tags[*]}")" &>/dev/null
813813
else
814-
local vm_config="/etc/pve/qemu-server/${vmid}.conf"
815-
if [[ -f "$vm_config" ]]; then
816-
sed -i '/^tags:/d' "$vm_config"
817-
if [[ ${#next_tags[@]} -gt 0 ]]; then
818-
echo "tags: $(IFS=';'; echo "${next_tags[*]}")" >> "$vm_config"
819-
fi
820-
fi
814+
qm set "${vmid}" --tags "$(IFS=';'; echo "${next_tags[*]}")" &>/dev/null
821815
fi
822816
else
823817
# Tags unchanged

0 commit comments

Comments
 (0)