Skip to content

config: persist config subgroups with their name and group id - #14050

Merged
sureshanaparti merged 1 commit into
apache:4.20from
nagaboinaramgopal:fix/config-subgroup-null-name
Sep 9, 2026
Merged

config: persist config subgroups with their name and group id#14050
sureshanaparti merged 1 commit into
apache:4.20from
nagaboinaramgopal:fix/config-subgroup-null-name

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown
Contributor

createOrupdateConfigObject created a missing configuration subgroup with the no-arg ConfigurationSubGroupVO constructor, so the row was written with a null name and null group_id. Because the name stayed null, the next findByNameAndGroup lookup missed again and inserted another null row on every management-server restart. Build the subgroup with its name and precedence and set its group id, matching the sibling configuration-group branch.

Tested: new unit test createConfigObjectPersistsSubGroupWithNameAndGroupId (captures the persisted VO); ConfigDepotImplTest green.

createOrupdateConfigObject created a missing configuration subgroup with the
no-arg ConfigurationSubGroupVO constructor, so the row was written with a null
name and null group_id. Because the name stayed null, the next
findByNameAndGroup lookup missed again and inserted another null row on every
management-server restart. Build the subgroup with its name and precedence and
set its group id, matching the sibling configuration-group branch.
@DaanHoogland DaanHoogland added this to the 4.20.4 milestone Sep 4, 2026
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.35%. Comparing base (2cd8c5e) to head (ad12283).

Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #14050   +/-   ##
=========================================
  Coverage     16.34%   16.35%           
- Complexity    13574    13579    +5     
=========================================
  Files          5669     5669           
  Lines        501368   501369    +1     
  Branches      60903    60903           
=========================================
+ Hits          81964    81982   +18     
+ Misses       410219   410205   -14     
+ Partials       9185     9182    -3     
Flag Coverage Δ
uitests 4.14% <ø> (ø)
unittests 17.21% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sureshanaparti sureshanaparti left a comment

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.

clgtm

@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19170

@sureshanaparti
sureshanaparti requested a lite review from Copilot September 9, 2026 11:55
@sureshanaparti sureshanaparti moved this from Backlog to In progress in CloudStack Testing Sep 9, 2026

@sudo87 sudo87 left a comment

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

@sudo87 sudo87 moved this from In progress to In review in CloudStack Testing Sep 9, 2026
@sureshanaparti
sureshanaparti merged commit 9c8bdf3 into apache:4.20 Sep 9, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in CloudStack Testing Sep 9, 2026

Copilot AI left a comment

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Fixes config subgroup persistence to avoid repeatedly inserting null-name/null-group rows on restart by constructing ConfigurationSubGroupVO with proper metadata and adding a unit test to lock in the behavior.

Changes:

  • Create ConfigurationSubGroupVO with subgroup name and precedence, and explicitly set groupId before persisting.
  • Add a unit test that captures the persisted subgroup VO and asserts name and groupId.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
framework/config/src/main/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java Ensures newly created subgroups are persisted with correct name/precedence and groupId.
framework/config/src/test/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImplTest.java Adds a regression test verifying subgroup persistence includes name and groupId.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +61 to +72
Mockito.when(_configSubGroupDao.findByNameAndGroup("ConsoleProxy VM", 1L)).thenReturn(null);
Mockito.when(_configSubGroupDao.persist(Mockito.any(ConfigurationSubGroupVO.class)))
.thenAnswer(invocation -> invocation.getArgument(0));
Mockito.when(_configDao.findById("consoleproxy.capacity.standby")).thenReturn(Mockito.mock(ConfigurationVO.class));

ArgumentCaptor<ConfigurationSubGroupVO> captor = ArgumentCaptor.forClass(ConfigurationSubGroupVO.class);
ReflectionTestUtils.invokeMethod(configDepotImpl, "createOrupdateConfigObject",
new Date(), "components", key, "someValue");

Mockito.verify(_configSubGroupDao).persist(captor.capture());
Assert.assertEquals("ConsoleProxy VM", captor.getValue().getName());
Assert.assertEquals(Long.valueOf(1L), captor.getValue().getGroupId());
Comment on lines +61 to +72
Mockito.when(_configSubGroupDao.findByNameAndGroup("ConsoleProxy VM", 1L)).thenReturn(null);
Mockito.when(_configSubGroupDao.persist(Mockito.any(ConfigurationSubGroupVO.class)))
.thenAnswer(invocation -> invocation.getArgument(0));
Mockito.when(_configDao.findById("consoleproxy.capacity.standby")).thenReturn(Mockito.mock(ConfigurationVO.class));

ArgumentCaptor<ConfigurationSubGroupVO> captor = ArgumentCaptor.forClass(ConfigurationSubGroupVO.class);
ReflectionTestUtils.invokeMethod(configDepotImpl, "createOrupdateConfigObject",
new Date(), "components", key, "someValue");

Mockito.verify(_configSubGroupDao).persist(captor.capture());
Assert.assertEquals("ConsoleProxy VM", captor.getValue().getName());
Assert.assertEquals(Long.valueOf(1L), captor.getValue().getGroupId());
ConfigurationSubGroupVO subGroupVO = _configSubGroupDao.findByNameAndGroup(subGroup.first(), groupId);
if (subGroupVO == null) {
subGroupVO = new ConfigurationSubGroupVO();
subGroupVO = new ConfigurationSubGroupVO(subGroup.first(), null, subGroup.second());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

6 participants