lxd: Mark images as cached consistently
Fixes https://github.com/canonical/lxd/issues/16576.
Changes:
This PR makes marking images as cached consistent among projects that have features.images disabled.
- If
features.imagesis disabled for the project, associate the image with thedefaultproject inside of theensureDownloadedImageFitWithinBudget()function. This ensures thatcached=yesis set for a new image downloaded implicitly usinglxc init <image> <instance_name>. - If
features.imagesis disabled for the project, associate the image with thedefaultproject duringlxc copy. This ensures thatcached=nois set for a new image downloaded explicitly usinglxc image copy.
@nmezhenskyi please can you add a test for this, ta
please can you add a test for this
@tomponline Will do!
There's just one more edge case to handle when it comes to explicitly copying images with lxc image copy to a project with features.images=false, so I'm working on that.
I also noticed that we have features.profiles option for projects that behaves similarly by letting projects with features.profiles=false use profiles from the default project, so I'm checking whether this works correctly as well.
please can you add a test for this
@tomponline Will do!
There's just one more edge case to handle when it comes to explicitly copying images with
lxc image copyto a project withfeatures.images=false, so I'm working on that.I also noticed that we have
features.profilesoption for projects that behaves similarly by letting projects withfeatures.profiles=falseuse profiles from thedefaultproject, so I'm checking whether this works correctly as well.
Nice one!