-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lxd: Set up default root device for new projects #14836
base: main
Are you sure you want to change the base?
Conversation
Jira ticket here: https://warthogs.atlassian.net/browse/LXD-2316. In discussion it seemed that the request was more that new projects shouldn't require extra setup steps from the user in order for simple actions such as launching an instance to succeed. |
Signed-off-by: Mark Bolton <[email protected]>
Since the root device is now added by default upon project creation, the testsuite should not try to re-add the root device, and should instead set it. Signed-off-by: Mark Bolton <[email protected]>
cc60bd6
to
bacd75c
Compare
@boltmark the jira card doesnt seem to have any discussion on it at all. @roosterfish @mseralessandri do you have any additional context/links for this? I am concerned this blanket change of behaviour will break existing users' workflows. |
@boltmark the jira card you linked to mentions server level project defaults, rather than changing the default profile config for all new profiles? |
Apparently the requester is @escabo and another person, so maybe he can provide more info. I had discussed this with him a few weeks ago and it seemed that this was the desired change -- but I could have misunderstood and I do see your point that this could affect current users' workflows. It broke quite a few tests... Perhaps this should instead provide the functionality to set default config such as a root device instead of doing so automatically for new projects as is done in this PR? |
I would like that newly created projects allow launching workloads seamlessly i.e. without having to define defaults. If this change risk breaking existing workflows then a new parameter to control that behaviour makes sense. |
Sorry to barge in here, it just came to me that |
Thanks @hamistao. The only issue I see with this is that we lose project functionality (no profiles in project) for the sole purpose of allowing immediate workload launch. @tomponline what do you think? I also updated the description with another potential option. |
I've been thinking about this on and off for a few days (in between meetings) and whilst the request "Set up default root device for new projects" seems, at first glance, to be trivial and obvious the more I think about it the more complicated it seems, so I'm going to try and write down here some of the concerns I have: So lets start with an easy one: 1. Does this apply new all profiles or just newly created default profiles in new projects?
Based on my discussions on this topic with @escabo and @edlerd the problem we are trying to solve is that when a new project is created (either via the UI or via So commands like So, the thinking goes, why don't we make newly created But, in my view, the quoted statement above has misunderstood that and has expanded the scope to now auto-populate "all new profiles will be set up with the root device from the default profile in the default project". This is almost certainly not what we want, as it will hinder the use of new profiles in existing projects for their main use case of storing snippets of configuration that can be combined in different ways to result in an expanded instance config. For example I might want to create a profile in an existing project (that already has a
This would combine 2 profiles, the myfastpool and the mynetworks one, resulting in an instance that uses the If we were to start adding a So can we agree that the original intent for this work was not to apply a |
Assuming the answer is "yes" to this, lets move onto other concerns... 2. Should this be the new default behavior or should it be configurable? The PR description describes a new global config key This is, I believe, on the right track, as changing the existing behavior such that new projects get the default project's root disk device always is very likely to break existing workflows (because they may add their own The question then becomes: Do we want to make this the new default and accept some user workflow breakages, or do we want to make this opt-in and have MicroCloud configure LXD when its provisioning it to enable this setting by default instead? |
Assuming the answer is "lets make this opt-in"... 3. Consider the behavior of The https://documentation.ubuntu.com/lxd/en/latest/reference/projects/#project-limits:limits.disk.pool.POOL_NAME option controls how much disk space a project can consume on a specified pool, if the value is set to So we should think about what the behavior should be if the default project's default profile's Should we not add a On a related point, today we have |
So easy ones out of the way now :) 4. What about non-disk devices? The original problem statement, as I understand it, is that a new project isn't ready to use for instances without additional manual configuration. For example, the missing But once we've fixed this issue, will we also face a similar problem with default network connectivity? A new instance can be created, but it wont have a network device when created in a fresh project. So should we also copy the This would raise similar questions as above, wrt to This then begs the question, where do we stop with this? Perhaps we should just copy the entire Or perhaps we should have a global server setting that specifies which profile in the default project should be used as the template for the default profile in newly created projects? Also, one idea I'm thinking of is that today we have a We could then offer a similar experience in the UI, so that when creating a new project, the UI asks which storage pool and network to use. This would avoid introducing new config keys and workflow breakages, but still make it easy to create a new project using the storage pool and network desired.
We could go the opposite way (or do both) and have the global config key specifying which profile to copy into the new project, and then add a 5. Other things to keep in mind
|
When creating a new project in the UI, we ask the user what should be the storage pool in the default profile for the new project. We preselect the pool from the default projects default profile. Users can change it. This way we enforce that a new projects default profile is always created with a pool selected. See screen below. So I think for the UI, the problem was resolved. |
Further details on the UI: On the "normal" creation of a new profile, no storage pool will be added or selected by default. The default there is create the profile with empty root storage setting. I think that is intended and correct. |
Cool thanks, we might want to do the same for NICs depending on the outcome of this discussion. |
Yeah i think this is good. |
This PR ensures that new projects set up a default profile with a root device inherited from the default project's default profile so that new projects can immediately host instances.
Updating this with another potential approach. This would avoid the issue of breaking current functionality, while adding a feature that would allow our users to benefit from seamless project creation -> workload launch.
Overview:
When a user creates a new project, the default profile created does not set up a root device. This means that launching workloads immediately after switching to a fresh project will fail -- the user would first need to set up the root device on the default profile. This behavior has been around since the beginning of profiles/projects, and is likely intertwined with user workflows and scripts. This makes it difficult to change the functionality.
One path forward is to allow configuration of default profiles at the server level. This would allow a user to configure their LXD server to use some root device as the default across all newly created profiles, including those created as defaults for new projects. With this change, existing functionality would not break, as this config would not be set by default. However, users can add this config to ensure a smooth workflow when creating new projects.
Implementation:
The config key
core.profiles_use_default_root
can be set to a boolean value. If set to true, then all new profiles will be set up with the root device from the default profile in the default project. This is configured at the server level.When new profiles are created, there will be 2 cases:
Potential issues with backward compatibility:
Since this is a new config key that will be introduced, and because this new functionality has effects if and only if the new config key is set, there should be no impact on current workflows or scripts that users have. If they do set this config key, however, without updating their workflows, then of course there will be issues (profile and project creation will fail).