Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[resourcemanager] Parse all node config JSON fields #204

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mlohvynenko
Copy link

No description provided.

@mlohvynenko mlohvynenko marked this pull request as draft October 4, 2024 11:27
@mlohvynenko mlohvynenko force-pushed the feature_parse_all_node_json branch 21 times, most recently from 4fb0ac7 to 4757b66 Compare October 9, 2024 17:00
@mlohvynenko mlohvynenko marked this pull request as ready for review October 9, 2024 17:00
src/resourcemanager/resourcemanager.cpp Outdated Show resolved Hide resolved
src/resourcemanager/resourcemanager.cpp Outdated Show resolved Hide resolved

for (size_t i = 0; i < inDevices.Size(); ++i) {
const auto& inDevice = inDevices[i];
auto& jsonDevice = jsonNodeConfig.devices[i];
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we check is inDevices.Size() <= len jsonNodeConfig.devices ?

Copy link
Author

Choose a reason for hiding this comment

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

Didn't get the point.
Do you mean array max size checks? (for json decode into aos it's done via Array::Resize calls, FillAosStruct for example).

For json encode from aos, no check are done. But anyway our structs rely on aos consts, as well as JSON object desriptors that are declared static in this cpp.

BTW, ocispec doesn't check boundaries when aos is converted into JSON as well

jsonDevice.hostDevicesLen = inDevice.mHostDevices.Size();

for (size_t j = 0; j < inDevice.mGroups.Size(); ++j) {
jsonDevice.groups[j] = inDevice.mGroups[j].CStr();
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

}

for (size_t j = 0; j < inDevice.mHostDevices.Size(); ++j) {
jsonDevice.hostDevices[j] = inDevice.mHostDevices[j].CStr();
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto


for (size_t i = 0; i < inResources.Size(); ++i) {
const auto& inResource = inResources[i];
auto& jsonResource = jsonNodeConfig.resources[i];
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

@mlohvynenko mlohvynenko force-pushed the feature_parse_all_node_json branch 4 times, most recently from 1cc3441 to 166f5bb Compare October 18, 2024 10:25
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 77.57009% with 24 lines in your changes missing coverage. Please review.

Project coverage is 69.47%. Comparing base (9b3105d) to head (2cd5e4d).
Report is 192 commits behind head on develop.

Files with missing lines Patch % Lines
src/resourcemanager/resourcemanager.cpp 77.57% 12 Missing and 12 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #204      +/-   ##
===========================================
- Coverage    70.79%   69.47%   -1.32%     
===========================================
  Files           22       25       +3     
  Lines         1825     2300     +475     
  Branches       487      580      +93     
===========================================
+ Hits          1292     1598     +306     
- Misses         258      411     +153     
- Partials       275      291      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants