Repository navigation
Performance improvements of AgentPropertiesFileHandler - #13852
Conversation
26e4af3 to
53f7168
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13852 +/- ##
============================================
+ Coverage 3.88% 20.78% +16.90%
- Complexity 0 21942 +21942
============================================
Files 493 6496 +6003
Lines 42580 591822 +549242
Branches 8072 72615 +64543
============================================
+ Hits 1653 123011 +121358
- Misses 40696 455460 +414764
- Partials 231 13351 +13120
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
DaanHoogland
left a comment
There was a problem hiding this comment.
not sure about the failure handling.
| LOGGER.info("Loaded {} properties from [{}]", newProperties.size(), agentPropertiesFile.getAbsolutePath()); | ||
|
|
||
| } catch (IOException ex) { | ||
| LOGGER.error("Failed to load properties from file [{}].", agentPropertiesFile.getAbsolutePath(), ex); |
There was a problem hiding this comment.
this seems FATAL to me. Any reason to keep running when this occurs
|
@blueorangutan package |
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM tested manually
Changes the KVM agent. It adds a cache for agent.properties; the management server is unaffected.
- The agent still reads its settings correctly
Before restarting, set a few non-default values in agent.properties. Each one here has an effect you can see:
cat >> /etc/cloudstack/agent/agent.properties <<'EOF'
host.tags=pr855
vm.memballoon.stats.period=10
iothreads=2
EOF
systemctl restart cloudstack-agent
[root@ref-trl-12390-k-Mol8-kiran-chavala-mgmt1 ~]# cmk list hosts type=Routing name=ref-trl-12390-k-Mol8-kiran-chavala-kvm1 filter=name,state,hosttags
{
"count": 1,
"host": [
{
"hosttags": "pr855",
"name": "ref-trl-12390-k-Mol8-kiran-chavala-kvm1",
"state": "Up"
}
]
}
[root@ref-trl-12390-k-Mol8-kiran-chavala-kvm1 ~]# virsh dumpxml i-2-3-VM | grep -E "stats period|<iothreads>"
<stats period='10'/>
- Updates the agent makes itself are picked up
[root@ref-trl-12390-k-Mol8-kiran-chavala-mgmt1 ~]# cmk update configuration name=host value=10.0.33.32
{
"configuration": {
"category": "Advanced",
"component": "ApiServiceConfiguration",
"defaultvalue": "localhost",
"description": "The ip address of management server. This can also accept comma separated addresses.",
"displaytext": "Host",
"group": "Hypervisor",
"isdynamic": true,
"name": "host",
"subgroup": "Hypervisor",
"type": "CSV",
"value": "10.0.33.32"
}
}
[root@ref-trl-12390-k-Mol8-kiran-chavala-kvm1 ~]# grep "^host=" /etc/cloudstack/agent/agent.properties
host=10.0.33.32@static
[root@ref-trl-12390-k-Mol8-kiran-chavala-kvm1 ~]# grep -E "Processed new management server list|Cleared agent properties cache after persisting key: host" /var/log/cloudstack/agent/agent.log | tail -2
2026-09-25 04:38:39,074 DEBUG [dao.impl.PropertiesStorage] (AgentRequest-Handler-2:null) (logid:eb7ab863) Cleared agent properties cache after persisting key: host
2026-09-25 04:38:39,074 INFO [cloud.agent.Agent] (AgentRequest-Handler-2:null) (logid:eb7ab863) Processed new management server list: 10.0.33.32@static
- How hand edits behave now
sed -i 's/^vm.memballoon.stats.period=.*/vm.memballoon.stats.period=20/' /etc/cloudstack/agent/agent.properties
cmk stop virtualmachine id=<vm>; cmk start virtualmachine id=<vm> hostid=<host-id>
[root@ref-trl-12390-k-Mol8-kiran-chavala-kvm1 ~]# virsh dumpxml i-2-3-VM | grep "stats period"
<stats period='10'/>
# PR build: still 10 (cached). After a restart, the new value is used:
systemctl restart cloudstack-agent
[root@ref-trl-12390-k-Mol8-kiran-chavala-kvm1 ~]# virsh dumpxml i-2-3-VM | grep "stats period"
<stats period='20'/>
|
@blueorangutan package |
|
@nvazquez 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19345 |
|
@blueorangutan test |
|
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-17042) |
|
@blueorangutan test |
|
@blueorangutan test |
|
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-17152)
|
53f7168 to
463ccf8
Compare
|
@blueorangutan package |
|
@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19958 |
Description
This PR optimizes the AgentPropertiesFileHandler.getPropertyValue method. This method is used to fetch properties values from agent.properties file. In the proposed change, the properties file is loaded lazily on first access and cached. The cache is invalidated whenever the agent persists a change via PropertiesStorage.persist, so agent-driven updates are picked up on the next read. External manual edits to agent.properties are not auto-detected and take effect after an agent restart.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?