Skip to content

Conversation

@chenbxun
Copy link

@chenbxun chenbxun commented Dec 11, 2025

What this PR does / why we need it:
Add dev_id support for ImageFile. A device can now carry an optional dev_id, which allows ImageService to
register, lookup, and manage ImageFile instances by a stable identifier.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?


TEST_F(DevIDTest, parse_config_with_dev_id) {
std::string config_path, dev_id;
parse_config_and_dev_id("path/to/config.v1.json;dev123", config_path, dev_id);
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 we only need a number without 'dev'

if(find_image_file(dev_id) != nullptr)
LOG_ERROR_RETURN(0, -1, "dev id exists: `", dev_id);
photon::scoped_lock lock(m_image_files_mtx);
m_image_files[dev_id] = file;
Copy link
Member

Choose a reason for hiding this comment

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

there is no need to set a scoped_lock here.
It's thread safe.

@BigVan BigVan merged commit 0357ece into containerd:dev/snapshot Dec 11, 2025
1 check passed
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