When testing the /nodes/{node}/lxc/{vmid}/config path for the API I noticed that a parse error is returned whenever the tags of a lxc instance are null.
Regardless of the error being returned the tags are updated correctly in both the null -> defined and defined -> null scenarios.
This same behavior is not reproducible for the equivalent qemu path.
Given that the lxc tags are null in the default state and the API throws 400 errors for these parse errors this is causing issues for clients expecting 2XX responses.
pveversion
pve-manager/6.3-3/eee5f901 (running kernel: 5.4.78-2-pve)
sudo pvesh get /nodes/.../lxc/1001/config --output-format json | json_pp
vm 1001 - unable to parse config: tags:
{
"tty" : 2,
"console" : 1,
"cpuunits" : 1024,
"swap" : 512,
"rootfs" : "vmstorage:vm-1001-disk-0,size=4G",
"protection" : 0,
"cpulimit" : "0",
"net0" : "...",
"hostname" : "...",
"onboot" : 0,
"memory" : 512,
"arch" : "amd64",
"ostype" : "ubuntu",
"digest" : "c8939fb8056655cc57e3cb997e126e211d3bf6ad",
"cmode" : "tty",
"cores" : 1
}
sudo pvesh set /nodes/.../lxc/1001/config -tags "test"
vm 1001 - unable to parse config: tags:
sudo pvesh get /nodes/.../lxc/1001/config --output-format json | json_pp
{
"console" : 1,
"memory" : 512,
"cpuunits" : 1024,
"tags" : "test",
"cores" : 1,
"swap" : 512,
"digest" : "98144008393b6c41d64942cbfc8e9a9b92e563b6",
"ostype" : "ubuntu",
"tty" : 2,
"hostname" : "...",
"protection" : 0,
"arch" : "amd64",
"cmode" : "tty",
"onboot" : 0,
"rootfs" : "vmstorage:vm-1001-disk-0,size=4G",
"net0" : "...",
"cpulimit" : "0"
}
sudo pvesh get /nodes/.../lxc/1001/config --output-format json | json_pp
{
"tags" : "test",
"cores" : 1,
"digest" : "98144008393b6c41d64942cbfc8e9a9b92e563b6",
"ostype" : "ubuntu",
"net0" : "...",
"console" : 1,
"hostname" : "...",
"protection" : 0,
"memory" : 512,
"arch" : "amd64",
"rootfs" : "vmstorage:vm-1001-disk-0,size=4G",
"cpuunits" : 1024,
"onboot" : 0,
"cmode" : "tty",
"tty" : 2,
"swap" : 512,
"cpulimit" : "0"
}
sudo pvesh set /nodes/.../lxc/1001/config -tags ""
vm 1001 - unable to parse config: tags:
Regardless of the error being returned the tags are updated correctly in both the null -> defined and defined -> null scenarios.
This same behavior is not reproducible for the equivalent qemu path.
Given that the lxc tags are null in the default state and the API throws 400 errors for these parse errors this is causing issues for clients expecting 2XX responses.
pveversion
pve-manager/6.3-3/eee5f901 (running kernel: 5.4.78-2-pve)
sudo pvesh get /nodes/.../lxc/1001/config --output-format json | json_pp
vm 1001 - unable to parse config: tags:
{
"tty" : 2,
"console" : 1,
"cpuunits" : 1024,
"swap" : 512,
"rootfs" : "vmstorage:vm-1001-disk-0,size=4G",
"protection" : 0,
"cpulimit" : "0",
"net0" : "...",
"hostname" : "...",
"onboot" : 0,
"memory" : 512,
"arch" : "amd64",
"ostype" : "ubuntu",
"digest" : "c8939fb8056655cc57e3cb997e126e211d3bf6ad",
"cmode" : "tty",
"cores" : 1
}
sudo pvesh set /nodes/.../lxc/1001/config -tags "test"
vm 1001 - unable to parse config: tags:
sudo pvesh get /nodes/.../lxc/1001/config --output-format json | json_pp
{
"console" : 1,
"memory" : 512,
"cpuunits" : 1024,
"tags" : "test",
"cores" : 1,
"swap" : 512,
"digest" : "98144008393b6c41d64942cbfc8e9a9b92e563b6",
"ostype" : "ubuntu",
"tty" : 2,
"hostname" : "...",
"protection" : 0,
"arch" : "amd64",
"cmode" : "tty",
"onboot" : 0,
"rootfs" : "vmstorage:vm-1001-disk-0,size=4G",
"net0" : "...",
"cpulimit" : "0"
}
sudo pvesh get /nodes/.../lxc/1001/config --output-format json | json_pp
{
"tags" : "test",
"cores" : 1,
"digest" : "98144008393b6c41d64942cbfc8e9a9b92e563b6",
"ostype" : "ubuntu",
"net0" : "...",
"console" : 1,
"hostname" : "...",
"protection" : 0,
"memory" : 512,
"arch" : "amd64",
"rootfs" : "vmstorage:vm-1001-disk-0,size=4G",
"cpuunits" : 1024,
"onboot" : 0,
"cmode" : "tty",
"tty" : 2,
"swap" : 512,
"cpulimit" : "0"
}
sudo pvesh set /nodes/.../lxc/1001/config -tags ""
vm 1001 - unable to parse config: tags: