Conversation
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 @wcwxyz - thanks for raising this! The code looks good, but there are a few tweaks to do to update cc-env
output and add some tests.
Also, note that the runtime is failing under SemaphoreCI with these changes, so that will need a bit of debugging.
I'm going to mark this PR as needing changes as a result.
Please let us know if you need any help with any of the above (and don't worry about the big red cross! 😄
config.go
Outdated
@@ -122,6 +124,31 @@ func (h hypervisor) image() string { | |||
return h.Image | |||
} | |||
|
|||
func (h hypervisor) kernelParams() []vc.Param { |
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.
Please could you add some tests to TestHypervisorDefaults()
for this new function.
config.go
Outdated
return deserializeParams(h.KernelParams) | ||
} | ||
|
||
func deserializeParams(paramString string) []vc.Param { |
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 should have a test too.
config.go
Outdated
@@ -193,6 +221,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) { | |||
HypervisorPath: hypervisor, | |||
KernelPath: kernel, | |||
ImagePath: image, | |||
KernelParams: kernelParams, |
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 cc-env
command should display the kernel params too. See commit 257b46a for an example of adding extra details to the cc-env
output (you'll need to update the formatVersion
as that commit did).
config/configuration.toml.in
Outdated
@@ -4,6 +4,8 @@ | |||
path = "@QEMUPATH@" | |||
kernel = "@KERNELPATH@" | |||
image = "@IMAGEPATH@" | |||
# Uncomment if having trouble running pre-2.15 glibc |
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 forgot to say, please can you add a comment stating the format of this variable. For example, it could become something like this:
# Optional space-separated list of options to pass to the guest kernel.
# For example, uncomment the line below if you are having trouble running pre-2.15 glibc
## kernel_params = "vsyscall=emulate"
I will update according to your comment. Thanks for review. |
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.
@wcwxyz The code looks very good to me. The only change I would like to see is having your changes rely as much as possible on the virtcontainers library. We already have a serializeParams
in virtcontainers, and about deserializeParams
, you should add it there.
config.go
Outdated
return params | ||
} | ||
|
||
func serializeParams(params []vc.Param) string { |
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.
Please use the function that already exists in virtcontainers: https://github.com/containers/virtcontainers/blob/master/hypervisor.go#L183
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'd like to re-use such functions as much as you do.
Do you know how should I submit PRs in both virtcontainers and runtime, and have semaphoreci/travis-ci working?
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.
Well the idea is that you submit the first PR to virtcontainers and after it got merged, we will revendor virtcontainers inside the runtime repository so that you can rely on the new function you have just created.
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.
That's good to know. Thank you.
config.go
Outdated
return h.KernelParams | ||
} | ||
|
||
func deserializeParams(paramString string) []vc.Param { |
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.
Please create this function in virtcontainers as it can be reused by any consumer of the virtcontainers library.
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.
Will do.
@wcwxyz I have updated the vendoring of virtcontainers for the runtime. You can now modify this PR so that it relies on the patch that you submitted to virtcontainers ;) |
Re-pushed(No code changes). Please take a look. Thanks. |
cc-env.go
Outdated
Hypervisor: hypervisor, | ||
Image: image, | ||
Kernel: kernel, | ||
KernelParams: kernelParams, |
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.
Running cc-runtime cc-env
gives the following:
[Kernel]
Path = "/usr/share/clear-containers/vmlinux.container"
Resolved = "/usr/share/clear-containers/vmlinux-4.9.35-62.container"
[KernelParams]
Parameters = ""
But what we really want is:
[Kernel]
[Kernel.Location]
Path = "/usr/share/clear-containers/vmlinux.container"
Resolved = "/usr/share/clear-containers/vmlinux-4.9.35-62.container"
Parameters = ""
That way, all the kernel details are kept under Kernel
. This is also in line with what we already have for Hypervisor
:
[Hypervisor]
MachineType = "pc-lite"
[Hypervisor.Location]
Path = "/usr/bin/qemu-lite-system-x86_64"
Resolved = "/usr/bin/qemu-lite-system-x86_64"
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.
ok, will do.
Add support to pass extra kernel parameters in configuration or directly configured on build. This information can be retrieved from cc-env. The story behind this feature is, I have trouble running centos:6 /bin/bash and it turns out guest kernel is using vsyscall=none which breaks old libc. Fixes: #368 Signed-off-by: WANG Chao <chao.wang@ucloud.cn>
LGTM |
It looks like one of the cri-o tests is problematic under semaphore. I've raised clearcontainers/tests#326 to investigate that issue. |
cpuinfo/arm64: Refine CPUInfo in Arm64
Add support to pass extra kernel parameters in configuration.
The story behind this feature is, I have trouble running centos:6
/bin/bash and it turns out guest kernel is using vsyscall=none which
breaks old libc.
Fixes: #368
Signed-off-by: WANG Chao chao.wang@ucloud.cn