Skip to content
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

Fix to use ContainerID for windows instead of SanbdoxID #2010

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

madhanrm
Copy link

@madhanrm madhanrm commented Nov 6, 2017

Use containerID for windows platform, since sandbox concept is not yet available in platform.
Once the support comes in future, we can revert this change.

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "hotaddfix" git@github.com:madhanrm/libnetwork.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@madhanrm
Copy link
Author

madhanrm commented Nov 6, 2017

@codecov-io
Copy link

codecov-io commented Nov 6, 2017

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2010   +/-   ##
=========================================
  Coverage          ?   38.01%           
=========================================
  Files             ?      137           
  Lines             ?    27370           
  Branches          ?        0           
=========================================
  Hits              ?    10406           
  Misses            ?    15691           
  Partials          ?     1273
Impacted Files Coverage Δ
controller.go 36.99% <40%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6bbcd1b...dcf79f8. Read the comment docs.

@madhanrm
Copy link
Author

madhanrm commented Nov 6, 2017

/assign @mavenugo

@madhanrm
Copy link
Author

madhanrm commented Nov 6, 2017

ping @friism

if sb.config.useDefaultSandBox {
return osl.GenerateKey("default")
}
return osl.GenerateKey(sb.containerID)
Copy link
Member

Choose a reason for hiding this comment

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

Thinking out loud here; Instead of making an exception here for windows, would it make sense to set sb.id to containerID when creating the sandbox? https://github.com/docker/libnetwork/blob/b5cc5c5dee7345ae2356540f235af94ee67af7e9/controller.go#L1018

Copy link
Author

Choose a reason for hiding this comment

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

Am looking at this option. Am not sure if that would break any other assumption

Copy link
Member

Choose a reason for hiding this comment

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

Not sure either, but was assuming that "id" would be treated as an opaque value; and if that works, no logic has to be changed down the line.

@mavenugo will be more familiar with that, and may be able to add some input on that

Copy link
Author

Choose a reason for hiding this comment

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

@thaJeztah am going with your suggestion which makes the changes simpler.
Am running a bunch of tests to make sure that it doesn't break anything on windows.

@@ -0,0 +1,12 @@
// +build windows
Copy link
Member

Choose a reason for hiding this comment

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

don't think this build tag is needed, because the file is already named _windows.go

@@ -0,0 +1,12 @@
// +build !windows
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 current convention is to name these files (shared by linux and freebsd) _unix.go

@madhanrm madhanrm force-pushed the hotaddfix branch 2 times, most recently from 813bb88 to 70f047e Compare November 7, 2017 00:49
Signed-off-by: Madhan Raj Mookkandy <madhanm@microsoft.com>
@madhanrm madhanrm changed the title Fix to use ContainerID for windows and SanbdoxID for other platforms Fix to use ContainerID for windows instead of SanbdoxID Nov 9, 2017
@madhanrm
Copy link
Author

@mavenugo As it was already agreed to use this assumption for windows, one particular change was missed out in the previous PR. Adding it now to complete the Hot add support in docker. Please review and merge this PR.

@madhanrm
Copy link
Author

@mavenugo Please reassign it to appropriate folks who could review and approve this PR.

@madhanrm
Copy link
Author

madhanrm commented Dec 7, 2017

@fcrisciani can you look into this?

@ddebroy
Copy link
Contributor

ddebroy commented Dec 8, 2017

Looks like a safe change scoped to Windows ... LGTM.

// Create sandbox and process options first. Key generation depends on an option
if sb == nil {
sb = &sandbox{
id: stringid.GenerateRandomID(),
id: sandboxID,
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick clarification: I assume the sb.id = "ingress_sbox" below does not affect Windows?

Copy link
Author

Choose a reason for hiding this comment

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

No it shouldn't affect windows

Copy link
Author

Choose a reason for hiding this comment

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

ping @ddebroy

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for clarifying .. LGTM.

@@ -1042,10 +1043,15 @@ func (c *controller) NewSandbox(containerID string, options ...SandboxOption) (S
}
c.Unlock()

sandboxID := stringid.GenerateRandomID()

Choose a reason for hiding this comment

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

If this is a temporary fix, can you please add a comment mentioning that is temporary and that the final fix is tracked in xxx ticket?

Copy link
Author

Choose a reason for hiding this comment

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

This is the fix for current windows platform support and not temporary.
Once we get underlying platform support (No ETA), will update this code.

@madhanrm
Copy link
Author

@fcrisciani Can we get this merged?

@friism
Copy link

friism commented Jan 22, 2018

ping @fcrisciani @ddebroy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants