Skip to content
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

cpu/memory configuration not reset after crc config unset preset #3652

Closed
cfergeau opened this issue May 11, 2023 · 0 comments
Closed

cpu/memory configuration not reset after crc config unset preset #3652

cfergeau opened this issue May 11, 2023 · 0 comments

Comments

@cfergeau
Copy link
Contributor

We recently added code to reset cpu/memory after a preset change, but at the moment this is only done for crc config set preset ....
These steps are not working as expected:

    crc config set preset podman
    crc config set cpus 3
    crc config unset preset
    crc config get cpus

This returns 3 instead of the expected 4 (default preset is openshift with a minimum requirement of 4 cpus).
This works as expected if I use crc config set preset okd instead of crc config unset preset.

I've started fixing this in https://github.com/cfergeau/crc/tree/config but this needs more testing (next week hopefully).

cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
The RegisterNotifier API can be used to be notified when the preset
changes, and to check that the memory/cpu config values match the
requirements for the current preset.

The code is config.go is generic with respect to the config key names,
hardcoding in the generic Set() method that there will be settings named
CPUs/Preset/Memory is a layering violation. With a notifier, we can move
it back to settings.go which is where we define the settings (Preset,
CPUs, ...) we'll be using.

This will also fix crc-org#3652
as the notifiers are triggered both for Set() and Unset()

After this commit, this will work as expected:

crc config set preset podman
crc config set cpus 3
crc config unset preset
crc config get cpus
cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
There are calls to config.UpdateDefaults in pkg/crc/api/ to reload the
configuration settings every time a config is set/unset. This ensures the
default cpus/memory values are correct when the preset changes.

Then there is code in pkg/crc/config.Set()/Unset() to reset the cpus/memory
values when the preset changes if they are out of spec.

This commit groups in UpdateDefaults all the work that is needed when
the preset changes. It moves the Set/Unset UpdateDefaults calls from
pkg/crc/api to pkg/crc/config

This should fix crc-org#3652
cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
The RegisterNotifier API can be used to be notified when the preset
changes, and to check that the memory/cpu config values match the
requirements for the current preset.

The code is config.go is generic with respect to the config key names,
hardcoding in the generic Set() method that there will be settings named
CPUs/Preset/Memory is a layering violation. With a notifier, we can move
it back to settings.go which is where we define the settings (Preset,
CPUs, ...) we'll be using.

This will also fix crc-org#3652
as the notifiers are triggered both for Set() and Unset()

After this commit, this will work as expected:

crc config set preset podman
crc config set cpus 3
crc config unset preset
crc config get cpus
cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
There are calls to config.UpdateDefaults in pkg/crc/api/ to reload the
configuration settings every time a config is set/unset. This ensures the
default cpus/memory values are correct when the preset changes.

Then there is code in pkg/crc/config.Set()/Unset() to reset the cpus/memory
values when the preset changes if they are out of spec.

This commit groups in UpdateDefaults all the work that is needed when
the preset changes. It moves the Set/Unset UpdateDefaults calls from
pkg/crc/api to pkg/crc/config

This should fix crc-org#3652
cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
The RegisterNotifier API can be used to be notified when the preset
changes, and to check that the memory/cpu config values match the
requirements for the current preset.

The code is config.go is generic with respect to the config key names,
hardcoding in the generic Set() method that there will be settings named
CPUs/Preset/Memory is a layering violation. With a notifier, we can move
it back to settings.go which is where we define the settings (Preset,
CPUs, ...) we'll be using.

This will also fix crc-org#3652
as the notifiers are triggered both for Set() and Unset()

After this commit, this will work as expected:

crc config set preset podman
crc config set cpus 3
crc config unset preset
crc config get cpus
cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
There are calls to config.UpdateDefaults in pkg/crc/api/ to reload the
configuration settings every time a config is set/unset. This ensures the
default cpus/memory values are correct when the preset changes.

Then there is code in pkg/crc/config.Set()/Unset() to reset the cpus/memory
values when the preset changes if they are out of spec.

This commit groups in UpdateDefaults all the work that is needed when
the preset changes. It moves the Set/Unset UpdateDefaults calls from
pkg/crc/api to pkg/crc/config

This should fix crc-org#3652
cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
The RegisterNotifier API can be used to be notified when the preset
changes, and to check that the memory/cpu config values match the
requirements for the current preset.

The code is config.go is generic with respect to the config key names,
hardcoding in the generic Set() method that there will be settings named
CPUs/Preset/Memory is a layering violation. With a notifier, we can move
it back to settings.go which is where we define the settings (Preset,
CPUs, ...) we'll be using.

This will also fix crc-org#3652
as the notifiers are triggered both for Set() and Unset()

After this commit, this will work as expected:

crc config set preset podman
crc config set cpus 3
crc config unset preset
crc config get cpus
cfergeau added a commit to cfergeau/crc that referenced this issue May 17, 2023
There are calls to config.UpdateDefaults in pkg/crc/api/ to reload the
configuration settings every time a config is set/unset. This ensures the
default cpus/memory values are correct when the preset changes.

Then there is code in pkg/crc/config.Set()/Unset() to reset the cpus/memory
values when the preset changes if they are out of spec.

This commit groups in UpdateDefaults all the work that is needed when
the preset changes. It moves the Set/Unset UpdateDefaults calls from
pkg/crc/api to pkg/crc/config

This should fix crc-org#3652
cfergeau added a commit to cfergeau/crc that referenced this issue May 23, 2023
The RegisterNotifier API can be used to be notified when the preset
changes, and to check that the memory/cpu config values match the
requirements for the current preset.

The code is config.go is generic with respect to the config key names,
hardcoding in the generic Set() method that there will be settings named
CPUs/Preset/Memory is a layering violation. With a notifier, we can move
it back to settings.go which is where we define the settings (Preset,
CPUs, ...) we'll be using.

This will also fix crc-org#3652
as the notifiers are triggered both for Set() and Unset()

After this commit, this will work as expected:

crc config set preset podman
crc config set cpus 3
crc config unset preset
crc config get cpus
cfergeau added a commit to cfergeau/crc that referenced this issue May 23, 2023
There are calls to config.UpdateDefaults in pkg/crc/api/ to reload the
configuration settings every time a config is set/unset. This ensures the
default cpus/memory values are correct when the preset changes.

Then there is code in pkg/crc/config.Set()/Unset() to reset the cpus/memory
values when the preset changes if they are out of spec.

This commit groups in UpdateDefaults all the work that is needed when
the preset changes. It moves the Set/Unset UpdateDefaults calls from
pkg/crc/api to pkg/crc/config

This should fix crc-org#3652
cfergeau added a commit to cfergeau/crc that referenced this issue May 26, 2023
The RegisterNotifier API can be used to be notified when the preset
changes, and to check that the memory/cpu config values match the
requirements for the current preset.

The code in config.go is generic with respect to the config key names,
hardcoding in the generic Set() method that there will be settings named
CPUs/Preset/Memory is a layering violation. With a notifier, we can move
it back to settings.go which is where we define the settings (Preset,
CPUs, ...) we'll be using.

This will also fix crc-org#3652
as the notifiers are triggered both for Set() and Unset()

After this commit, this will work as expected:

crc config set preset podman
crc config set cpus 3
crc config unset preset
crc config get cpus
cfergeau added a commit to cfergeau/crc that referenced this issue May 26, 2023
There are calls to config.UpdateDefaults in pkg/crc/api/ to reload the
configuration settings every time a config is set/unset. This ensures the
default cpus/memory values are correct when the preset changes.

Then there is code in pkg/crc/config.Set()/Unset() to reset the cpus/memory
values when the preset changes if they are out of spec.

This commit groups in UpdateDefaults all the work that is needed when
the preset changes. It moves the Set/Unset UpdateDefaults calls from
pkg/crc/api to pkg/crc/config

This should fix crc-org#3652
anjannath pushed a commit that referenced this issue May 29, 2023
There are calls to config.UpdateDefaults in pkg/crc/api/ to reload the
configuration settings every time a config is set/unset. This ensures the
default cpus/memory values are correct when the preset changes.

Then there is code in pkg/crc/config.Set()/Unset() to reset the cpus/memory
values when the preset changes if they are out of spec.

This commit groups in UpdateDefaults all the work that is needed when
the preset changes. It moves the Set/Unset UpdateDefaults calls from
pkg/crc/api to pkg/crc/config

This should fix #3652
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant