-
Notifications
You must be signed in to change notification settings - Fork 997
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
kata-manager: Allow hypervisor to be changed #9059
kata-manager: Allow hypervisor to be changed #9059
Conversation
Note that running with |
5c84b0c
to
a45b9a5
Compare
Two thoughts:
|
I've updated the branch today to add in |
As demonstrated by the doc changes on this PR, using the |
94056f5
to
3dcd534
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jodh-intel this LGTM although I have not tested it locally
Thanks, @cmaf!
What you can do is run the code using $ bash -c "$(curl -fsSL https://raw.githubusercontent.com/kata-containers/kata-containers/3dcd5341637fd60d7b9f86602acb0312dcf005d0/utils/kata-manager.sh) -h"
See https://github.com/kata-containers/kata-containers/blob/main/utils/README.md for other options not added on this PR. |
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jodh-intel, I have a few suggestions, none of those are code related so far.
Please, let me know your thoights.
|
||
### Choose a Hypervisor | ||
|
||
Kata works with different [hypervisors](../docs/hypervisors.md). When you install a Kata system, the default hypervisor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the motivation on linking to the hypervisors page, but the user will not know which name to use to select, for instance, "Cloud Hypervisor".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a way to have the list of supported hypervisors being displayed without installing kata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not explained in the commits, but I tried to minimise what we hard-code in the script as it's better to rely on the structure of the packaged config files to determine the logic. Further, it will simplify our lives when we tackle #8677 and #9060.
I've now updated the branch so that the hypervisors.md
page shows the short names, which allows the users to determine the names used by the script.
$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/kata-containers/kata-containers/main/utils/kata-manager.sh) -H clh" | ||
``` | ||
|
||
> **Note:** See the [List available hypervisors](#list-available-hypervisors) section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This note is not that much useful as we don't have a way to actually list the hypervisors before we install Kata Containers. :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc now lists the "short names".
However, I am wondering about removing the -H
option since, effectively, that option just installs Kata, then calls -S
. There isn't much benefit to providing -H
since we still need to install Kata. Then the -S
just does the config switch. wdyt to removing -H
?
utils/README.md
Outdated
#### List available hypervisors | ||
|
||
Run the following on an installed system: | ||
|
||
```bash | ||
$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/kata-containers/kata-containers/main/utils/kata-manager.sh) -L" | ||
``` | ||
|
||
#### Show the default packaged hypervisor | ||
|
||
To show the default packaged hypervisor, run the following on an | ||
installed system: | ||
|
||
```bash | ||
$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/kata-containers/kata-containers/main/utils/kata-manager.sh) -L" | grep default | ||
``` | ||
|
||
#### Show the locally configured hypervisor | ||
|
||
`kata-manager.sh` will create a "local" copy of the packaged Kata configuration | ||
file. | ||
|
||
To show details of the _local_ copy of the configuration files on an | ||
installed system, run: | ||
|
||
```bash | ||
$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/kata-containers/kata-containers/main/utils/kata-manager.sh) -e" | ||
``` | ||
|
||
> **Note:** This command can only be run once Kata has been installed. | ||
|
||
> See the [configuration documentation](https://github.com/kata-containers/kata-containers#configuration) | ||
> for further information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if those 3 options could be combined into a single one which would output something like:
HYPERVISOR | ARGUMENT NAME | DEFAULT
Cloud Hypervisor | clh | yes
QEMU | qemu | no
,,,,
Or something towards that line ...
NOTE: After the next release e should remove all the mentions to $ bash -c ...
and just point to the script directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if those 3 options could be combined into a single one
I'm not totally clear what you mean by this comment but I have updated the hypervisors doc to include more hypervisor config details including the "short name" used by kata-manager
.
NOTE: After the next release e should remove all the mentions to $ bash -c ... and just point to the script directly.
Yep - see #9091.
A few more notes here:
This output is not user friendly, and dragonball is not golang. :-) Also, what's the value of having |
I noticed you'be been changing the default configuration on |
3dcd534
to
54fd20f
Compare
It is admittedly more "fiddly" to deal with, but |
It's designed to be parseable, but we could add in a tab separated format too.
Correct. See my note at #9059 (comment). That issue is caused by the fact that the Kata project hasn't produced a new release in four months. Related: #9064.
I can update the usage.
I could drop that. It's there to show these are packaged config short names. We're not showing the full paths (since they may differ, are quite long and would make the output even worse unless you're happy with line wrapping or happen to have a wide terminal), so need an indicator as to whether these are the pristine packaged config files, or if they are the local config file copies. |
@@ -737,6 +737,7 @@ configure_kata() | |||
sudo install -o root -g root -m 0644 "$cfg_from" "$cfg_to" | |||
|
|||
sudo sed -i \ | |||
--follow-symlinks \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch @jodh-intel !
I wasnt aware myself about this behaviour myself. Reading about this, it shows that GNU sed has --follow-symlinks, while BSD sed does not. It will be useful to atleast document this here, in case someone tries to use this/port this to MacOS. We afterall do support macos to some extent.
We could mention something like "If you're on macOS or another BSD variant, you'll need to install GNU sed via your package manager (brew, pkg, etc)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
> **Note:** For details of each hypervisor, see [3]. | ||
|
||
- If an invalid hypervisor name is specified with the '-H' option, an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I do not like the concept of designating any partcular hypervisor as default. I feel all the hypervisors should be treated the same with the user choosing one based on his/her needs.
(While I do understand that configuration.toml points to qemu conf by default, we should limit the usage of default and not designate any one hypervisor as default)
If there is a failure on configuration here, could we just go back to previous configuration instead of default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @amshinde - I don't disagree with what you've said, but we need some way to designate "the currently configured hypervisor". How about just configured
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jodh-intel Yes that wording works for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amshinde - Switching everything to configured
unfortunately results in a less clear approach. For example, how does the user "undo all changes" and revert to the pristine default configured hypervisor?
The current approach is:
$ kata-manager.sh -S default
But that just looks odd if we change the name to configured
as it just doesn't express the same intent:
$ kata-manager.sh -S configured
That's confusing and ambiguous imho as it doesn't suggest the value specified to the -S
option means "revert to the original configured hypervisor".
The best I can come up with as a compromise is:
$ kata-manager.sh -S pristine
wdyt?
/cc @fidencio
@@ -23,6 +23,8 @@ readonly containerd_slug="containerd/containerd" | |||
readonly kata_project_url="https://github.com/${kata_slug}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding my comment here, but this is for the commiot message. Just reading the commit message, the usage of filename fragments is not really clear to me. Could we reword it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
54fd20f
to
a4f4999
Compare
I've also changed the format so that it now uses tabs rather than semi-colons so that it's still parseable but looks a bit less "busy" 😄 |
a4f4999
to
0429771
Compare
/test |
0429771
to
9ddd823
Compare
/test |
Remove extraneous whitespace. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Ensure the usage statement lists all options in alphabetical order. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Add an info message just before the archive file is checked. This keeps the user informed about what is happening as it can take a few seconds to perform the checks on slower systems. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
The `configure_kata()` function modifies the configuration file to enable debug. But it was doing this by calling `sed -i` which, by default, creates a new _file_ from the `configuration.toml` symbolic link. This defeated the point of the symbolic link which is supposed to resolve to the local copy of the pristine config file, so we now use the GNU sed(1) specific `---follow-symlinks` option to retain the sym-link. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Add new options to allow the configured hypervisor to be changed: - `-L`: List available _packaged_ hypervisor config short names. - `-e`: List available _local_ hypervisor config names. - `-H <hypervisor>`: Install Kata then switch to the specified hypervisor. - `-S <hypervisor>`: Switch to the specified hypervisor (by config short name [Errors if Kata not installed]). For example, to install Kata and configure it to use Cloud Hypervisor with the golang Kata runtime: ```bash $ kata-manager.sh -H clh ``` To switch back to the default hypervisor: ```bash $ kata-manager.sh -S default ``` To show details of the available packaged configs: ```bash $ kata-manager.sh -L ``` To show details of the local configs: ```bash $ kata-manager.sh -e ``` > **Notes:** > > - This change **only** applies to the current default (golang) Kata runtime. > > - Although this is mainly for users wishing to switch hypervisor (by > changing the Kata config file to another of the packaged config files > provided for specific hypervisors), strictly it allows users to change > to _any_ config file. For example, if the user has a config file called > `/etc/kata-containers/configuration-my-custom-config.toml`, they could > switch to this by running: > > ```bash > $ kata-manager.sh -S my-custom-config > ``` > > - The "config short names" are the hypervisor specific part of the configuration file name. > For example, the config short name for file `configuration-qemu.toml` is > `qemu` and the config short name for `configuration-clh.toml` is `clh`. Fixes: kata-containers#8305. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Remove extraneous whitespace from hypervisors doc. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
9ddd823
to
5d21040
Compare
Add details to the README for `kata-manager` showing how to list available hypervisor configs (packaged and local), and switch between the configurations. Also, update the hypervisors page to show a lot more detail about the hypervisor configurations, including the "short name" used by `kata-manager` for switching hypervisor config. > **Note:** > > These changes only apply to the current default golang runtime. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
5d21040
to
7af892f
Compare
/test |
The ARM CI (
/cc @jongwu. |
kata-manager: Allow hypervisor to be changed
Add new options to allow the configured hypervisor to be changed:
-L
: List available packaged hypervisor config names (filename fragments).-e
: List available local hypervisor config names (filename fragments).-H <hypervisor>
: Install Kata then switch to the specified hypervisor (by filename fragment).-S <hypervisor>
: Switch to the specified hypervisor (by filename fragment [Errors if Kata not installed]).For example, to install Kata and configure it to use Cloud Hypervisor
with the golang Kata runtime:
To switch back to the default hypervisor:
To show details of the available packaged configs:
To show details of the local configs:
Fixes: #8305.
Signed-off-by: James O. D. Hunt james.o.hunt@intel.com