Skip to content

resmgr: name to container ID mapping fixes - #727

Merged
askervin merged 4 commits into
containers:mainfrom
klihub:fixes/duplicate-name-mapping
Aug 3, 2026
Merged

resmgr: name to container ID mapping fixes#727
askervin merged 4 commits into
containers:mainfrom
klihub:fixes/duplicate-name-mapping

Conversation

@klihub

@klihub klihub commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

This patch series improves container name to ID mapping, used for transient duplicate detection.

In particular, we now mark containers as exited during initial state synchronization with the runtime. This should prevent subsequent configuration updates from trying to allocate resources for both the old and the new instance, in case the old has not been removed yet. Also during initial sync, remove unmapped (disambiguated older duplicate) instances from the list of containers to be (re)allocated. This should prevent double accounting of resources for transient duplicates.

Additionally, when trying to detect transient stale duplicate containers for overlapping container create/crash/stop then re-create events, try to be smarter about which instance is the stale one. For a CreateContainer event always choose the old one. Otherwise for an initial sync, use the CreatedAt timestamps if available. If not, then assume that a container in running state is stale if the other one is in created state.

Finally, add a new e2e test case to trigger and test the handling of transient dupicates.

@klihub
klihub requested a review from askervin July 29, 2026 18:59
@klihub
klihub marked this pull request as draft July 29, 2026 18:59

@askervin askervin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Very nice... just one question and one nit.

Comment thread pkg/resmgr/nri.go Outdated
@klihub
klihub force-pushed the fixes/duplicate-name-mapping branch 2 times, most recently from 46f06f1 to 420f454 Compare July 30, 2026 10:18
@klihub

klihub commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

@askervin Addressed review comments. Also the actual fix was missing to prevent re-allocation of resource for old instances of transient duplicates. Added it an updated the test case to verify that the internal post-allocated duplicate detection runs clean, never detecting any duplicate resource allocations.

@klihub
klihub marked this pull request as ready for review July 30, 2026 10:20
@klihub
klihub requested a review from askervin July 30, 2026 10:20
@klihub klihub changed the title resmgr: improve name to container ID mapping/duplicate detection resmgr: name to container ID mapping fixes Jul 30, 2026
@klihub
klihub force-pushed the fixes/duplicate-name-mapping branch 2 times, most recently from 90ccaf8 to 02898ed Compare July 31, 2026 10:33

@askervin askervin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

@askervin askervin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@klihub,

Yet I already put my approval on this, may I ask you to fix my mistake in the commit string?

I'd also propose removing "fixup: e2e:..." part from the commit message of:
"e2e: add test for duplicate disambiguation".
(Removes another spelling error: "ry" instead of "try", and we won't need that part in the commit message anyway.)

I think with these fixes this PR is good for merging.

@klihub
klihub force-pushed the fixes/duplicate-name-mapping branch from 02898ed to fba75ec Compare August 3, 2026 08:05
@klihub

klihub commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

@klihub,

Yet I already put my approval on this, may I ask you to fix my mistake in the commit string?

I'd also propose removing "fixup: e2e:..." part from the commit message of: "e2e: add test for duplicate disambiguation". (Removes another spelling error: "ry" instead of "try", and we won't need that part in the commit message anyway.)

Argh... that was just me fat-fingering the squashed commit message, unintentional. Thanks for spotting it.

@klihub
klihub requested a review from askervin August 3, 2026 08:06
klihub and others added 4 commits August 3, 2026 11:07
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Mark containers as exited during initial state synchronization
with the runtime. This should prevent subsequent configuration
updates from trying to allocate resources for both the old and
the new instance, in case the old has not been removed yet.

When trying to detect transient stale duplicate containers for
overlapping container create/crash/stop then re-create events,
try to be smarter about which instance is the stale one. For a
CreateContainer event always choose the old one. Otherwise for
an initial sync, use the CreatedAt timestamps if available. If
not, then assume that a container in running state is stale if
the other one is in created state.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
- If DEBUG_LOGGERS is not specified, configure the same debug loggers
  as earlier, with one exception.
- Drop "nri-resource-policy" logger as there is no such a thing.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
Add an test case to trigger and test the handling of
transient duplicate container disambiguation.

Co-authored-by: Antti Kervinen <antti.kervinen@intel.com>
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
@klihub
klihub force-pushed the fixes/duplicate-name-mapping branch from fba75ec to c8342fa Compare August 3, 2026 08:07

@askervin askervin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, Thanks @klihub, this is a great fix!

@askervin
askervin merged commit accbbd3 into containers:main Aug 3, 2026
14 checks passed
@klihub
klihub deleted the fixes/duplicate-name-mapping branch August 3, 2026 16:21
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.

2 participants