lxd
lxd copied to clipboard
`PATCH /1.0/projects/<project>` removes existing configuration
When you try to update a specific configuration option for a project using PATCH, existing configuration options are discarded:
ubuntu@ru-fu01:~$ lxc project show my-project1
name: my-project1
description: ""
config:
features.images: "false"
features.profiles: "false"
features.storage.buckets: "true"
features.storage.volumes: "true"
used_by: []
ubuntu@ru-fu01:~$ lxc query --request PATCH /1.0/projects/my-project1 --data '{
"config": {
"limits.containers": "5"
}
}'
Error: Delete project default profile: Profile not found
ubuntu@ru-fu01:~$ lxc query --request PATCH /1.0/projects/my-project1 --data '{
"config": {
"limits.containers": "5",
"features.profiles": "false"
}
}'
ubuntu@ru-fu01:~$ lxc project show my-project1
name: my-project1
description: ""
config:
features.profiles: "false"
limits.containers: "5"
used_by: []
This could be regarded as intended behaviour (since you're updating the "config" field - which could mean the FULL "config" field). But this is inconsistent with how PATCH works for, for example, profiles:
ubuntu@ru-fu01:~$ lxc profile show testprofile
name: testprofile
description: ""
config:
limits.cpu: "4"
limits.memory: 1GiB
devices:
root:
path: /
pool: default
size: 1GiB
type: disk
used_by: []
ubuntu@ru-fu01:~$ lxc query --request PATCH /1.0/profiles/testprofile --data '{
"config": {
"user.test": "hello"
}
}'
ubuntu@ru-fu01:~$ lxc profile show testprofile
name: testprofile
description: ""
config:
limits.cpu: "4"
limits.memory: 1GiB
user.test: hello
devices:
root:
path: /
pool: default
size: 1GiB
type: disk
used_by: []
Sounds like a bug to me.