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

[TEST PR - DNM] Nonetns #835

Closed
wants to merge 2 commits into from
Closed

Conversation

caoruidong
Copy link
Member

@caoruidong caoruidong commented Oct 18, 2018

This is a test PR. Since last pr got some errors I can't understand. I test this to find out the reason.

@caoruidong caoruidong force-pushed the nonetns branch 3 times, most recently from c39451e to 224705c Compare October 18, 2018 03:43
@caoruidong
Copy link
Member Author

/test

@codecov
Copy link

codecov bot commented Oct 18, 2018

Codecov Report

Merging #835 into master will increase coverage by 0.12%.
The diff coverage is 4.68%.

@@            Coverage Diff             @@
##           master     #835      +/-   ##
==========================================
+ Coverage    66.1%   66.23%   +0.12%     
==========================================
  Files          87       87              
  Lines       10509    10539      +30     
==========================================
+ Hits         6947     6980      +33     
+ Misses       2863     2855       -8     
- Partials      699      704       +5

@caoruidong
Copy link
Member Author

/test

Copy link
Member

@bergwolf bergwolf left a comment

Choose a reason for hiding this comment

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

What about createEndpointsFromScan? In the none model, we should not scan the netns at all, right?

@@ -832,6 +838,12 @@ func doNetNS(netNSPath string, cb func(ns.NetNS) error) error {
}
defer currentNS.Close()

// if netNSPath is empty, the callback function will be run in the current network namespace.
// So skip useless GetNS and Set, just call cb().
if netNSPath == "" {
Copy link
Member

Choose a reason for hiding this comment

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

In such case, we don't need LockOSThread() nor GetCurrentNS(). Please skip the whole function and just call the callback function directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, exactly. @bergwolf Thanks for your review. I'll address them in original PR. This pr is just a test and will be closed after I find why CI fails.

NicName string
TAPIface NetworkInterface
VMFds []*os.File
VhostFds []*os.File
Copy link
Member

Choose a reason for hiding this comment

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

This is much alike NetworkInterfacePair struct. Please unify them with embedded types so that we have something like:

type VMInterface struct {
        ID        string
        Name      string
        TAPIface  NetworkInterface
        NetInterworkingModel
        VMFds    []*os.File
        VhostFds []*os.File
}

type NetworkInterfacePair struct {
    VMInterface
    NetInterworkingModel
    VirtIface NetworkInterface
}

type TapEndpoint struct {
    VMInterface
    EndpointProperties NetworkInfo
    EndpointType EndpointType
    PCIAddr string
}

case NetXConnectMacVtapModel:
if err := q.hotplugMacvtap(drive); err != nil {
case TapEndpointType:
drive := endpoint.(*TapEndpoint)
Copy link
Member

Choose a reason for hiding this comment

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

These two types are similar and can be handled similarly with a helper function.

@jodh-intel
Copy link
Contributor

Hi @caoruidong. I understand from https://github.com/kata-containers/runtime/pull/835/files#r226216859 that this is a test PR, based on #733.

Raising test PRis is fine, but it would help users if you could explain this to avoid confusion :)

I'll update the title of this PR to make it clearer...

@jodh-intel jodh-intel changed the title Nonetns [TEST PR - DNM] Nonetns Oct 18, 2018
@caoruidong
Copy link
Member Author

@jodh-intel Thank you. I will try to not open test pr anymore :)

@jodh-intel
Copy link
Contributor

Hi @caoruidong - please do raise test PRs if you need to :) All I mean is that we have so many PRs "flying around", it helps a lot if you link back to the original PR and make it clear your PR is a test PR.

Refactor these functions so differernt types of endpoints can use a unified
function to hotplug nics.

Fixes kata-containers#731

Signed-off-by: Ruidong Cao <[email protected]>
…point

This model is for not creating a new net ns for VM and directly
creating taps in the host net ns.

Signed-off-by: Ruidong Cao <[email protected]>
@caoruidong
Copy link
Member Author

original PR: #733

@caoruidong
Copy link
Member Author

@jodh-intel Yeah. I mean I don't want to meet CI problem once more…

@caoruidong caoruidong closed this Oct 23, 2018
@caoruidong caoruidong deleted the nonetns branch October 24, 2018 03:40
egernst pushed a commit to egernst/runtime that referenced this pull request Feb 9, 2021
To update device resource entries from host to guest, we search for the
right entry by host major:minor numbers, then later update it.  However
block and character devices exist in separate major:minor namespaces so
we could have one block and one character device with matching major:minor
and thus incorrectly update both with the details for whichever device is
processed second.

Add a check on device type to prevent this.

Fixes: kata-containers#835

Signed-off-by: David Gibson <[email protected]>
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.

3 participants