Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

image-builder: fill out device namespace information into kata image#236

Merged
jodh-intel merged 6 commits intokata-containers:masterfrom
devimc:topic/fixDAX
Mar 14, 2019
Merged

image-builder: fill out device namespace information into kata image#236
jodh-intel merged 6 commits intokata-containers:masterfrom
devimc:topic/fixDAX

Conversation

@devimc
Copy link
Copy Markdown

@devimc devimc commented Mar 8, 2019

The new NVDIMM driver implementation (kernel >= 4.16) needs to know the device
namespace information to map pages, this metadata is read from the nvdimm
namespace at 4k offset.

fixes #235

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 8, 2019

/test

@@ -0,0 +1,171 @@
/*
* Copyright(c) 2013-2019 Intel Corporation. All rights reserved.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2013? Wow ;)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, copy&paste from NVDIMM driver

mv "${tmp_img}" "${IMAGE}"
# Set metadata header
gcc -O2 "${script_dir}/nsdax.c" -o "${script_dir}/nsdax"
"${script_dir}/nsdax" "${IMAGE}" "${IMG_HEADER_SZ_B}" "${IMG_HEADER_SZ_B}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random thought: I wonder if there would be any value in adding info to osbuilder.yaml for kata-collect-data.sh to use?

* Copyright(c) 2013-2019 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just mentioning that the license for this file (GPL-2.0) is different to the license for the containing osbuilder repo project (Apache-2.0).

/cc @grahamwhaley.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good pick up. IANAL, but I believe as long as you are not linking this to any of our (apache2) code (and I think you are not), then you are probably good.
This file local license will I think over-rule the top level license. I don't know if we have to say something at the top level about 'some files may be under a different license' now though.

Overall, if you can confirm you are not linking this against any apache2 code, then I'm not going to worry about it.
Some attribution somewhere about where the code came from might be good if we did not add one already..

Copy link
Copy Markdown
Author

@devimc devimc Mar 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm, I'm not linking this against any apache2 code

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be interesting to discuss if we wanted to switch our LICENSE files to use the Debian machine readable copyright file format since that handles this sort of scenario nicely:

@devimc devimc force-pushed the topic/fixDAX branch 2 times, most recently from d4981a3 to 1737068 Compare March 8, 2019 17:59
@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 8, 2019

@jodh-intel CI is not happy

ERROR: Required license identifier ('SPDX-License-Identifier: Apache-2.0') missing from following files:

and the workaround is ... ?

@jodh-intel
Copy link
Copy Markdown

@devimc - hmm, well you've hit a new scenario - 1st file in one of our repos that originated elsewhere. Aside from introducing that machine-readable copyright file (which I'm liking more and more now ;-) I just mentioned (which would allow the CI to intelligently filter out files like this), I'm not sure. We can't add a different license but how do we retain the check for the majority of other files?

For speed, we could either hack the CI script to special-case this file. But how about instead we do one of the following:

  • Put the file in a special" directory and make the CI check ignore that directory.

    Something like no-check/nsdax.c.

  • Add a "magic tag" to the file and tweak the CI script to ignore such files for license checks.

    Something like @KATA_IGNORE_LICENSE_CHECK@ ?

    This would be easy to implement and minimally invasive I reckon?

@jodh-intel
Copy link
Copy Markdown

@devimc - thinking about this a bit more, how about the following:

So for your new file, we could create a .ci/ignore in the osbuilder repo containing:

# some explanatory comments

license:image-builder/nsdax.c:imported file has its own license.

wdyt @chavafg, @egernst, @grahamwhaley, @sboeuf?

But for the really quick solution, I think you can use a hack: Move the file to the following location since "vendored" files are ignored! :-):

image-builder/vendor/nsdax.c

@grahamwhaley
Copy link
Copy Markdown
Contributor

In this specific case, I quite favor a one off hack or force merge. If we do get more and more files coming into the repos then I think we can discuss better workarounds. Let's not add a slew of complication to fix a problem that doesn't yet exist...

@jodh-intel
Copy link
Copy Markdown

@devimc - can you move the file to the vendor/ directory then to get this resolved? I'd also recommend creating a tiny README.md in that directory explaining why that .c file is in that directory.

@devimc devimc force-pushed the topic/fixDAX branch 2 times, most recently from 87e4b52 to 166d3d6 Compare March 11, 2019 13:40
@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 11, 2019

@jodh-intel

ERROR: PR changes vendor files, but does not update Gopkg.lock
The command ".ci/setup.sh" failed and exited with 1 during .

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 11, 2019

@jodh-intel please take a look kata-containers/tests#1280

@jodh-intel
Copy link
Copy Markdown

Our CI is waaaaay too clever! 😆

@devimc devimc force-pushed the topic/fixDAX branch 3 times, most recently from 7ee7204 to d840a5a Compare March 11, 2019 14:40
@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 11, 2019

/test

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 11, 2019

Euleros mirrors are down

[Errno 14] HTTP Error 404 - Not Found
Trying other mirror.


 One of the configured repositories failed (EulerOS-base),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable EulerOS-base

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=EulerOS-base.skip_if_unavailable=true

failure: repodata/362dfa7e4e1a25ea3d988a1af4848d61f67f10143dbdc5349d80c2c7890ecb44-primary.sqlite.bz2 from EulerOS-base: [Errno 256] No more mirrors to try.
http://developer.huawei.com/ict/site-euleros/euleros/repo/yum/2.2/os/x86_64/repodata/362dfa7e4e1a25ea3d988a1af4848d61f67f10143dbdc5349d80c2c7890ecb44-primary.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found

@jodh-intel
Copy link
Copy Markdown

@devimc, @chavafg, @marcov - as we continue to have problems with EulerOS due to mirror speed / availability (#46), and as it sounds like this cannot be resolved, I wonder if we should just disable it entirely for the CI. Something like:

diff --git a/tests/test_config.sh b/tests/test_config.sh
index 4e76274..7b4c8b4 100644
--- a/tests/test_config.sh
+++ b/tests/test_config.sh
@@ -6,9 +6,9 @@
 # List of distros not to test, when running all tests with test_images.sh
 typeset -a skipWhenTestingAll
 
-if [ -n "${TRAVIS:-}" ]; then
-       # (travis may timeout with euleros, see:
-       #  https://github.com/kata-containers/osbuilder/issues/46)"
+if [ -n "${CI:-}" ]; then
+       # CI tests may timeout with euleros, see:
+       #  https://github.com/kata-containers/osbuilder/issues/46"
        skipWhenTestingAll+=(euleros)
 fi

That way, it would still be used locally, but would not block our CI.

@jodh-intel
Copy link
Copy Markdown

/cc @jcvenegas.

@chavafg
Copy link
Copy Markdown
Contributor

chavafg commented Mar 11, 2019

Yes, I agree with the change @jodh-intel

@jcvenegas jcvenegas mentioned this pull request Mar 11, 2019
Copy link
Copy Markdown
Member

@jcvenegas jcvenegas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, one comment related on the process about build it.

# copy final image
mv "${tmp_img}" "${IMAGE}"
# Set metadata header
gcc -O2 "${script_dir}/nsdax.gpl.c" -o "${script_dir}/nsdax"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necesary for this PR but I wonder if could create a separate makefile target for this, and would be really useful would be

make 
make install DESDIR

then check in this scritpt if this binary exist, it does run it.

I ask because fedora is packaging osbuilder scripts today. So I dont want to compile this at post install.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for add the issue.

@marcov
Copy link
Copy Markdown
Contributor

marcov commented Mar 11, 2019

@devimc, @chavafg, @marcov - as we continue to have problems with EulerOS due to mirror speed / availability (#46), and as it sounds like this cannot be resolved

agree

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 11, 2019

/test

@jodh-intel
Copy link
Copy Markdown

CI's are failing with:

+ docker run --rm -i --runtime kata-runtime busybox cat /proc/version
docker: Error response from daemon: OCI runtime create failed: Failed to check if grpc server is working: rpc error: code = Unavailable desc = transport is closing: unknown.

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 12, 2019

/test

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 12, 2019

CI is failing because the latest kernel is not installed, we need this change kata-containers/packaging#385 in this pr 😢

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 12, 2019

/test

@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 12, 2019

depends on #243

Julio Montes added 6 commits March 13, 2019 13:05
dnf and rmp data are not needed in the final rootfs, removing them we save
2MB of disk

Signed-off-by: Julio Montes <julio.montes@intel.com>
guest kernel needs 64 bytes of DRAM per 4K page of emulated PMEM, hence the
image size should be as small as possible to reduce the container's memory
footprint. The image size is recalculated automatically if it's too small
to contain the rootfs.

Signed-off-by: Julio Montes <julio.montes@intel.com>
$/${} is unnecessary on arithmetic variables. [SC2004]

Signed-off-by: Julio Montes <julio.montes@intel.com>
Rootfs data must be sync'd after copying it into the image to avoid
data corruption

Signed-off-by: Julio Montes <julio.montes@intel.com>
gcc is required to build the binary in charge to fill out the device
namespace information (matadata) into the kata containers image.

Signed-off-by: Julio Montes <julio.montes@intel.com>
The new NVDIMM driver implementation (kernel >= 4.16) needs to know the device
namespace information to map pages, this metadata is read from the nvdimm
namespace at 4k offset.

fixes kata-containers#235

Signed-off-by: Julio Montes <julio.montes@intel.com>
@devimc
Copy link
Copy Markdown
Author

devimc commented Mar 13, 2019

/test

Copy link
Copy Markdown

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @devimc.

lgtm

@jodh-intel jodh-intel merged commit ecd0724 into kata-containers:master Mar 14, 2019
jodh-intel pushed a commit to jodh-intel/runtimes that referenced this pull request Mar 21, 2019
osbuilder recently added the ability to create images with a DAX/NVDIMM
header [1], however this change broke the data collection script. Update
that script to handle images with and without this header.

The data collection script will now assume a header is present. However,
if it fails to find the required partition data, it will try again, this
time assuming the image does not have a DAX/NVDIMM header.

Fixes kata-containers#1404.

[1] - kata-containers/osbuilder#236

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory footprint increment: DAX unsupported by block device. Turning off DAX

6 participants