Skip to content

libnetwork/drivers/windows: fix error-matching for hcsshim "not found"#49202

Merged
akerouanton merged 1 commit intomoby:masterfrom
thaJeztah:hcsshim_stringmatch
Jan 3, 2025
Merged

libnetwork/drivers/windows: fix error-matching for hcsshim "not found"#49202
akerouanton merged 1 commit intomoby:masterfrom
thaJeztah:hcsshim_stringmatch

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jan 2, 2025

relates to:

libnetwork/drivers/windows: fix error-matching for hcsshim "not found"

This code has some gnarly string-matching to detect "not found" errors
returned by hcsshim.

Hcsshim at some point changed this error to lowercase;
microsoft/hcsshim@6d67a30

It looks like we ran into that problem in integration tests, which was
fixed in c530c9c when updating hcsshim,
however, it was only fixed in tests, and hiding the actual issue in our
code.

It looks like hcsshim has some utilities to detect error-types, such as the
IsElementNotFoundError function in hcn, which is the newer API that also wraps
the "HNS" service;
https://github.com/microsoft/hcsshim/blob/d9a4231b9d7a03dffdabb6019318fc43eb6ba996/hcn/hcnerrors.go#L75-L77

But unfortunately, the hns API used by us, does not return typed errors, and
returns HNS errors as a untyped formatted string.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 28.0.0 milestone Jan 2, 2025
@thaJeztah thaJeztah self-assigned this Jan 2, 2025
@thaJeztah thaJeztah force-pushed the hcsshim_stringmatch branch from 11a0595 to 5507887 Compare January 2, 2025 21:57
@thaJeztah thaJeztah marked this pull request as draft January 2, 2025 21:57
@thaJeztah
Copy link
Member Author

Temporarily moved to draft as it's stacked on #49201

@thaJeztah
Copy link
Member Author

OH! I'm wrong; it's not hcsshim v0.12, but the same bump as what caused ; this is the offending commit; microsoft/hcsshim@6d67a30

This PR:

@thaJeztah thaJeztah force-pushed the hcsshim_stringmatch branch from 5507887 to 7ed6c18 Compare January 2, 2025 22:10
@thaJeztah thaJeztah changed the title libnetwork/drivers/windows: fix error-matching for hcsshim v0.12 libnetwork/drivers/windows: fix error-matching for hcsshim "not found" Jan 2, 2025
This code has some gnarly string-matching to detect "not found" errors
returned by hcsshim.

Hcsshim at some point changed this error to lowercase;
microsoft/hcsshim@6d67a30

It looks like we ran into that problem in integration tests, which was
fixed in c530c9c when updating hcsshim,
however, it was only fixed in tests, and hiding the actual issue in our
code.

It looks like hcsshim has some utilities to detect error-types, such as the
IsElementNotFoundError function in hcn, which is the newer API that also wraps
the "HNS" service;
https://github.com/microsoft/hcsshim/blob/d9a4231b9d7a03dffdabb6019318fc43eb6ba996/hcn/hcnerrors.go#L75-L77

But unfortunately, the hns API used by us, does not return typed errors, and
returns HNS errors as a untyped formatted string.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the hcsshim_stringmatch branch from 7ed6c18 to 5b31a5b Compare January 2, 2025 22:15
@thaJeztah thaJeztah marked this pull request as ready for review January 2, 2025 22:15
@akerouanton akerouanton merged commit 1917be1 into moby:master Jan 3, 2025
139 checks passed
@thaJeztah thaJeztah deleted the hcsshim_stringmatch branch January 3, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants