close
Skip to content

Fix to use ContainerID for windows instead of SandboxID#2010

Merged
fcrisciani merged 1 commit into
moby:masterfrom
madhanrm:hotaddfix
Jan 23, 2018
Merged

Fix to use ContainerID for windows instead of SandboxID#2010
fcrisciani merged 1 commit into
moby:masterfrom
madhanrm:hotaddfix

Conversation

@madhanrm

@madhanrm madhanrm commented Nov 6, 2017

Copy link
Copy Markdown

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
Copy Markdown

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

madhanrm commented Nov 6, 2017

Copy link
Copy Markdown
Author

@codecov-io

codecov-io commented Nov 6, 2017

Copy link
Copy Markdown

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

madhanrm commented Nov 6, 2017

Copy link
Copy Markdown
Author

/assign @mavenugo

@madhanrm

madhanrm commented Nov 6, 2017

Copy link
Copy Markdown
Author

ping @friism

Comment thread sandbox_windows.go Outdated
if sb.config.useDefaultSandBox {
return osl.GenerateKey("default")
}
return osl.GenerateKey(sb.containerID)

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.

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

Comment thread sandbox_windows.go Outdated
@@ -0,0 +1,12 @@
// +build windows

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.

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

Comment thread sandbox_others.go Outdated
@@ -0,0 +1,12 @@
// +build !windows

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.

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
Copy Markdown
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
Copy Markdown
Author

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

@madhanrm

madhanrm commented Dec 7, 2017

Copy link
Copy Markdown
Author

@fcrisciani can you look into this?

@ddebroy

ddebroy commented Dec 8, 2017

Copy link
Copy Markdown
Contributor

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

Comment thread controller.go
if sb == nil {
sb = &sandbox{
id: stringid.GenerateRandomID(),
id: sandboxID,

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.

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

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.

No it shouldn't affect windows

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.

ping @ddebroy

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.

thanks for clarifying .. LGTM.

Comment thread controller.go
}
c.Unlock()

sandboxID := stringid.GenerateRandomID()

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Author

@fcrisciani Can we get this merged?

@friism

friism commented Jan 22, 2018

Copy link
Copy Markdown

ping @fcrisciani @ddebroy

@fcrisciani fcrisciani merged commit 5ab4ab8 into moby:master Jan 23, 2018
@thaJeztah thaJeztah changed the title Fix to use ContainerID for windows instead of SanbdoxID Fix to use ContainerID for windows instead of SandboxID Apr 30, 2025
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