systemvm: fix failed to get script version when patch system vm or router#10962
Conversation
…uter This is a regression of apache#9900 prior to this PR ``` 2025-06-05 12:28:53,992 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand 2025-06-05 12:29:25,959 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-1:[]) (logid:) Patch result of systemVM s-368-VM: /root 2025-06-05 12:29:25,961 WARN [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-1:[]) (logid:) Failed to get the latest script version 2025-06-05 12:29:25,962 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Seq 2-7450361158554357406: { Ans: , MgmtId: 32986204472275, via: 2, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 14 05:22:13 PM UTC 2025","scriptsVersion":"5ebc6ded1a3880732363c1cdbbd54cfb ``` with this PR ``` 2025-06-05 12:42:46,219 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Request:Seq 2-7450361158554357463: { Cmd , MgmtId: 32986204472275, via: 2, Ver: v1, Flags: 100011, [{"com.cloud.agent.api.PatchSystemVmCommand":{"forced":"true","accessDetails":{"router.ip":"169.254.151.188","router.name":"s-368-VM"},"wait":"0","bypassHostMaintenance":"false"}}] } 2025-06-05 12:42:46,220 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand 2025-06-05 12:43:18,083 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-2:[]) (logid:) Patch result of systemVM s-368-VM: /root 2025-06-05 12:43:18,083 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Seq 2-7450361158554357463: { Ans: , MgmtId: 32986204472275, via: 2, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 14 05:22:13 PM UTC 2025","scriptsVersion":"5ebc6ded1a3880732363c1cdbbd54cfb","result":"true","details":"Successfully patched systemVM s-368-VM ","wait":"0","bypassHostMaintenance":"false"}}] } ```
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.20 #10962 +/- ##
=========================================
Coverage 16.17% 16.17%
- Complexity 13293 13295 +2
=========================================
Files 5656 5656
Lines 498098 498098
Branches 60423 60423
=========================================
+ Hits 80568 80571 +3
+ Misses 408562 408560 -2
+ Partials 8968 8967 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@weizhouapache 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 ✔️ debian ✔️ suse15. SL-JID 14068 |
|
@blueorangutan test |
|
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-13708)
|
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a regression where patching system VMs or routers failed to retrieve the latest script version by refining the keystore import logic in the patch script.
- Restricts global cacerts import to only consoleproxy and secstorage types
- Suppresses keytool stderr output to reduce log noise
|
@blueorangutan package |
|
@weizhouapache 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 14931 |
|
@kiranchavala |
|
moving to 4.20.3 due to inactivity |
|
@blueorangutan package |
|
@shwstppr 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. |
shwstppr
left a comment
There was a problem hiding this comment.
LGTM. Tested patch operation with and without script changes,
Before,
[root@ref-trl-5997-k-Mr9-abhishek-kumar-kvm1 ~]# tail -f /var/log/cloudstack/agent/agent.log | grep -i "patch"
2025-09-26 06:49:02,567 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Request:Seq 1-4092364686396374076: { Cmd , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 100011, [{"com.cloud.agent.api.PatchSystemVmCommand":{"forced":"true","accessDetails":{"router.ip":"169.254.50.99","router.name":"v-5-VM"},"wait":"0","bypassHostMaintenance":"false"}}] }
2025-09-26 06:49:02,568 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand
2025-09-26 06:49:31,951 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-2:[]) (logid:) Patch result of systemVM v-5-VM: /root
2025-09-26 06:49:31,953 WARN [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-2:[]) (logid:) Failed to get the latest script version
2025-09-26 06:49:31,953 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Seq 1-4092364686396374076: { Ans: , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 28 06:10:04 AM UTC 2025","scriptsVersion":"b4448303d00dcfb38ffb30b071fd3891
","result":"true","details":"Successfully patched systemVM v-5-VM ","wait":"0","bypassHostMaintenance":"false"}}] }
After making changes to the script on my existing env KVM host (patched CPVM, SSVM VR),
No errors/warnings seen
[root@ref-trl-5997-k-Mr9-abhishek-kumar-kvm1 ~]# tail -f /var/log/cloudstack/agent/agent.log | grep -i "patch"
2025-09-26 06:53:26,216 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Request:Seq 1-4092364686396374106: { Cmd , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 100011, [{"com.cloud.agent.api.PatchSystemVmCommand":{"forced":"true","accessDetails":{"router.ip":"169.254.50.99","router.name":"v-5-VM"},"wait":"0","bypassHostMaintenance":"false"}}] }
2025-09-26 06:53:26,216 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand
2025-09-26 06:53:56,683 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-1:[]) (logid:) Patch result of systemVM v-5-VM: /root
2025-09-26 06:53:56,683 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Seq 1-4092364686396374106: { Ans: , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 28 06:10:04 AM UTC 2025","scriptsVersion":"b4448303d00dcfb38ffb30b071fd3891","result":"true","details":"Successfully patched systemVM v-5-VM ","wait":"0","bypassHostMaintenance":"false"}}] }
2025-09-26 06:55:07,444 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-5:[]) (logid:) Request:Seq 1-4092364686396374116: { Cmd , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 100011, [{"com.cloud.agent.api.PatchSystemVmCommand":{"forced":"true","accessDetails":{"router.ip":"169.254.233.55","router.name":"s-1-VM"},"wait":"0","bypassHostMaintenance":"false"}}] }
2025-09-26 06:55:07,444 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-5:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand
2025-09-26 06:56:06,441 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-5:[]) (logid:) Patch result of systemVM s-1-VM: /root
2025-09-26 06:56:06,442 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-5:[]) (logid:) Seq 1-4092364686396374116: { Ans: , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 28 06:10:04 AM UTC 2025","scriptsVersion":"b4448303d00dcfb38ffb30b071fd3891","result":"true","details":"Successfully patched systemVM s-1-VM ","wait":"0","bypassHostMaintenance":"false"}}] }
2025-09-26 06:56:50,668 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Request:Seq 1-4092364686396374121: { Cmd , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 100011, [{"com.cloud.agent.api.PatchSystemVmCommand":{"forced":"true","accessDetails":{"router.ip":"169.254.255.19","router.name":"r-4-VM"},"wait":"0","bypassHostMaintenance":"false"}}] }
2025-09-26 06:56:50,668 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand
2025-09-26 06:57:17,328 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-1:[]) (logid:) Patch result of systemVM r-4-VM: version:b4448303d00dcfb38ffb30b071fd3891
2025-09-26 06:57:17,329 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Seq 1-4092364686396374121: { Ans: , MgmtId: 32988435843878, via: 1, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 28 06:10:04 AM UTC 2025","scriptsVersion":"b4448303d00dcfb38ffb30b071fd3891","result":"true","details":"Successfully patched systemVM r-4-VM ","wait":"0","bypassHostMaintenance":"false"}}] }
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15178 |
|
thanks @shwstppr ! |
|
@blueorangutan test |
|
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-14444)
|
…uter (apache#10962) This is a regression of apache#9900 prior to this PR ``` 2025-06-05 12:28:53,992 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand 2025-06-05 12:29:25,959 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-1:[]) (logid:) Patch result of systemVM s-368-VM: /root 2025-06-05 12:29:25,961 WARN [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-1:[]) (logid:) Failed to get the latest script version 2025-06-05 12:29:25,962 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-1:[]) (logid:) Seq 2-7450361158554357406: { Ans: , MgmtId: 32986204472275, via: 2, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 14 05:22:13 PM UTC 2025","scriptsVersion":"5ebc6ded1a3880732363c1cdbbd54cfb ``` with this PR ``` 2025-06-05 12:42:46,219 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Request:Seq 2-7450361158554357463: { Cmd , MgmtId: 32986204472275, via: 2, Ver: v1, Flags: 100011, [{"com.cloud.agent.api.PatchSystemVmCommand":{"forced":"true","accessDetails":{"router.ip":"169.254.151.188","router.name":"s-368-VM"},"wait":"0","bypassHostMaintenance":"false"}}] } 2025-06-05 12:42:46,220 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Processing command: com.cloud.agent.api.PatchSystemVmCommand 2025-06-05 12:43:18,083 DEBUG [resource.wrapper.LibvirtPatchSystemVmCommandWrapper] (AgentRequest-Handler-2:[]) (logid:) Patch result of systemVM s-368-VM: /root 2025-06-05 12:43:18,083 DEBUG [cloud.agent.Agent] (AgentRequest-Handler-2:[]) (logid:) Seq 2-7450361158554357463: { Ans: , MgmtId: 32986204472275, via: 2, Ver: v1, Flags: 10, [{"com.cloud.agent.api.PatchSystemVmAnswer":{"templateVersion":"Cloudstack Release 4.20.1 Wed May 14 05:22:13 PM UTC 2025","scriptsVersion":"5ebc6ded1a3880732363c1cdbbd54cfb","result":"true","details":"Successfully patched systemVM s-368-VM ","wait":"0","bypassHostMaintenance":"false"}}] } ```
Description
This PR fixes a regression of #9900
prior to this PR
with this PR
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?