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

Cloud Hypervisor: driver update number 2 #2274

Merged
merged 4 commits into from
Dec 2, 2019
Merged

Cloud Hypervisor: driver update number 2 #2274

merged 4 commits into from
Dec 2, 2019

Conversation

ericooper
Copy link
Contributor

This PR introduces unit tests for clh driver #2205 and fixes for #2271 and #2270 noticed during development of the unit tests.

ericooper and others added 3 commits November 25, 2019 09:37
Merge #3 of kata-containers/runtime
added logging of stdout and stderr for failed hypervisor

Fixes: #2271

Signed-off-by: Johan Kuijpers <[email protected]>
remove type in kill statement for virtiofsd

Fixes: #2270

Signed-off-by: Johan Kuijpers <[email protected]>
Copy link
Contributor

@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 @ericooper! Great to see a large dump of new tests like this 😄

supportedMinorVersion)
return errors.New(errorMessage)
if clh.version.Major < supportedMajorVersion && clh.version.Minor < supportedMinorVersion {
errorMessage := fmt.Sprintf("Unsupported version: cloud-hypervisor %d.%d not supported by this driver version (%d.%d)",
Copy link
Contributor

Choose a reason for hiding this comment

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

How about changing the message to say something like: cloud hypervisor version too old (need atleast %d.%d, found %d.%d) or similar?


if clh.config.Debug {
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "RUST_BACKTRACE=FULL")
cmd.Env = append(cmd.Env, "RUST_BACKTRACE=full")
Copy link
Contributor

Choose a reason for hiding this comment

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

Random thought: we could probably do with this in virtcontainers/fc.go too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so. But to me it looks like it only makes sense in combination with capturing stdout and stderr (of the exec/fork cmd output buffers) otherwise you still don't see what's going on.

@@ -854,6 +863,11 @@ func (clh *cloudHypervisor) LaunchClh() (string, int, error) {
return errStr, cmd.Process.Pid, nil
}

// MaxAcrnVCPUs returns the maximum number of vCPUs supported
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment doesn't match code (the static analysis script would detect this I believe).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the checks didn't report it but nevertheless this is obviously a cut and paste error and hence corrected.

// Cli helper functions
//

func cliToString(args []string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could simplify this (or remove it?) in favour of:

strings.TrimSpace(strings.Join(args, " "))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed and renamed

assert.NoError(err)
assert.NotNil(cli)

netarg, errr := getCliOption(cli.args, "--net")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: should this be err? (same comment for other functions below).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed.

// --cmdline <cmdline> Kernel command line
//
func TestClhCliKernelParameters(t *testing.T) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: blank line at start of lots of functions.

Copy link
Member

Choose a reason for hiding this comment

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

I think best practice to not start with newline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

best practice is what's good for my eyes :)
removed

Copy link
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.

Could you do rebase instead of merge I see one commit is a merge - LGTM

@ericooper
Copy link
Contributor Author

Could you do rebase instead of merge I see one commit is a merge - LGTM

I'm not sure what you mean with this. The merge you see is the one I do frequently to keep my fork up-to-date with kata-runtime/master ie in opposite direction. Shouldn't be a problem or?

@jcvenegas
Copy link
Member

Could you do rebase instead of merge I see one commit is a merge - LGTM

I'm not sure what you mean with this. The merge you see is the one I do frequently to keep my fork up-to-date with kata-runtime/master ie in opposite direction. Shouldn't be a problem or?

Not a problem at all, common practice I use to not have merge commits after update my branch with master is rebase master - so the PR that will be merged only include the list of patches you added but not a blocker at all :)

git pull master
git checkout my-branch
git rebase master

- added clh unit tests
- removed some inconsistencies in the cli builder to enable unit tests
- suppressed version check for in startSandbox to enable unit tests
- added clh related constants and methods to virtcontainer test
- small corrections after review applied

Fixes: #2205

Signed-off-by: Johan Kuijpers <[email protected]>
@jcvenegas
Copy link
Member

/test

@codecov
Copy link

codecov bot commented Dec 2, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@d054556). Click here to learn what that means.
The diff coverage is 47.22%.

@@           Coverage Diff            @@
##             master   #2274   +/-   ##
========================================
  Coverage          ?   50.5%           
========================================
  Files             ?     111           
  Lines             ?   16073           
  Branches          ?       0           
========================================
  Hits              ?    8118           
  Misses            ?    6968           
  Partials          ?     987

@jcvenegas jcvenegas merged commit d50eea6 into kata-containers:master Dec 2, 2019
supportedMajorVersion,
supportedMinorVersion)
return errors.New(errorMessage)
if clh.version.Major < supportedMajorVersion && clh.version.Minor < supportedMinorVersion {
Copy link
Contributor

@tedyu tedyu Dec 3, 2019

Choose a reason for hiding this comment

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

supportedMajorVersion is 0.
How can clh.version.Major be lower than 0 ?

This check excludes supportedMinorVersion from being 0 as well (e.g. major == 1 and minor == 0).

Copy link
Contributor

@tedyu tedyu Dec 3, 2019

Choose a reason for hiding this comment

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

I think the correct condition should be:

	if clh.version.Major < supportedMajorVersion || (clh.version.Major == supportedMajorVersion && clh.version.Minor < supportedMinorVersion) {

Submitted #2312

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.

6 participants