Skip to content

Use hcsshim osversion package for version checks, instead of docker/docker/pkg/system#2362

Closed
thaJeztah wants to merge 1 commit intomoby:masterfrom
thaJeztah:improve_windows_version_handling
Closed

Use hcsshim osversion package for version checks, instead of docker/docker/pkg/system#2362
thaJeztah wants to merge 1 commit intomoby:masterfrom
thaJeztah:improve_windows_version_handling

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah commented Apr 8, 2019

This depends on #2361, which brings in an up-to-date version of hcsshim.

This replaces the use of docker/docker/pkg/system, in favour of the same code from Microsoft/hcsshim.

With this package, hard-coded build numbers are replaced with constants that are now defined in hcsshim.

Note that build 16236 is not defined in the package, and may be referring to RS2 (which was a client-only release).

Checks for that version were added in commits;

a9db5c5 (#1900), and 6681c02 (#2070)

In a9db5c5, it is described that the intent was to allow these options only in Windows RS3 so I changed the comparisons to match RS3 (and up) or disable the option on anything older than RS3.


func endpointRequest(method, path, request string) (*hcsshim.HNSEndpoint, error) {
if windowsBuild == 14393 {
if windowsBuild == osversion.RS1 {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also wondering if this should be

Suggested change
if windowsBuild == osversion.RS1 {
if windowsBuild < osversion.RS3 {

(assuming RS2 is EOL / obsolete)

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.

Either is fine since RS2 is obsolete.
I have a slight preference to "windowsBuild == osversion.RS1" since that is what we investigated and validated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Per the discussion on microsoft/hcsshim#556 (comment), this should likely be more defensive and take anything < RS5

Suggested change
if windowsBuild == osversion.RS1 {
if windowsBuild < osversion.RS5 {

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.

LGTM.

}
hnsresponse, err := hcsshim.HNSEndpointRequest(method, path, request)
if windowsBuild == 14393 {
if windowsBuild == osversion.RS1 {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here;

Suggested change
if windowsBuild == osversion.RS1 {
if windowsBuild < osversion.RS3 {

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.

This should match what you do above.
So:
if windowsBuild < osversion.RS5 {

Comment thread drivers/windows/windows.go Outdated
for _, elem := range qosPolicies {
encodedPolicy, err := json.Marshal(hcsshim.QosPolicy{
Type: "QOS",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a (dirty) workaround for gofmt changes between Go 1.10 and Go 1.11 and up. Adding this blank line makes it produce the same formatting on both versions (thus preventing CI linting failures if it checks for gofmt)

hnsEndpoint.Policies = append(hnsEndpoint.Policies, paPolicy)

if osversion.Get().Build > 16236 {
if osversion.Get().Build >= osversion.RS3 {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@pradipd @nwoodmsft please double-check if this is OK (see my top comment); I suspect 16236 referred to RS2, which is not included in the constants (perhaps it should, even if it wasn't a Windows Server build?)

There's some more like these below

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.

I think ^ should be safe. RS3 EOL is right around the corner too, so even Build > osversion.RS3 should be okay in terms of docker engine support.

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.

Yes. that is correct. Thanks!

@thaJeztah thaJeztah force-pushed the improve_windows_version_handling branch from 4b5ac00 to 0ad66db Compare April 8, 2019 11:29
@thaJeztah
Copy link
Copy Markdown
Member Author

ping @pradipd @mavenugo @ddebroy (#2070 (comment)) PTAL

@thaJeztah thaJeztah force-pushed the improve_windows_version_handling branch 2 times, most recently from 1f34543 to e8cb470 Compare April 12, 2019 23:52
@thaJeztah
Copy link
Copy Markdown
Member Author

force-pushed to trigger CI

@thaJeztah thaJeztah force-pushed the improve_windows_version_handling branch from e8cb470 to eb73a24 Compare April 25, 2019 00:06
@thaJeztah
Copy link
Copy Markdown
Member Author

updated to use < osversion.RS5 { as discussed above

@thaJeztah
Copy link
Copy Markdown
Member Author

Failure is a flaky test; FAIL: TestNetworkDBIslands; I'll re-push to trigger ci

@thaJeztah thaJeztah force-pushed the improve_windows_version_handling branch from eb73a24 to b87dbc4 Compare April 25, 2019 17:12
@thaJeztah thaJeztah force-pushed the improve_windows_version_handling branch 2 times, most recently from 18db6ab to 315d4ab Compare June 25, 2019 11:48
@thaJeztah
Copy link
Copy Markdown
Member Author

rebased to get rid of the commits from #2361

@pradipd @ddebroy @euanh ptal

Copy link
Copy Markdown
Contributor

@selansen selansen left a comment

Choose a reason for hiding this comment

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

LGTM

@pradipd
Copy link
Copy Markdown
Contributor

pradipd commented Jun 25, 2019

LGTM

@thaJeztah
Copy link
Copy Markdown
Member Author

we might have to hold off merging this one, pending the discussion on microsoft/hcsshim#581 (comment)

@thaJeztah thaJeztah force-pushed the improve_windows_version_handling branch from 315d4ab to 386403d Compare November 25, 2019 18:03
@thaJeztah
Copy link
Copy Markdown
Member Author

Looks like microsoft/hcsshim#581 (comment) was resolved, so I rebased this; this should be ready to go now

ping @selansen @arkodg PTAL

This replaces the hard-coded build numbers with constants that
are now defined in hcsshim.

Note that build 16236 is not defined in the package, and may
be referring to RS2 (which was a client-only release).

Checks for this version were added in commits;

a9db5c5 (moby#1900), and
6681c02 (moby#2070)

In a9db5c5, it is described
that the intent was to allow these options only in Windows RS3
so I changed the comparisons to match RS3 (and up), or disable
the option on anything older than RS3.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the improve_windows_version_handling branch from 386403d to b000a74 Compare April 7, 2021 15:11
@corhere
Copy link
Copy Markdown
Collaborator

corhere commented Jan 19, 2024

Obsoleted by moby/moby#43254

@corhere corhere closed this Jan 19, 2024
@thaJeztah thaJeztah deleted the improve_windows_version_handling branch January 20, 2024 00:45
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.

5 participants