Fix NPE in NASBackupProvider when no running KVM host is available#12805
Fix NPE in NASBackupProvider when no running KVM host is available#12805jmsperu wants to merge 2 commits intoapache:4.22from
Conversation
ResourceManager.findOneRandomRunningHostByHypervisor() can return null when no KVM host in the zone has status=Up (e.g. during management server startup, brief agent disconnections, or host state transitions). NASBackupProvider.syncBackupStorageStats() and deleteBackup() call host.getId() without a null check, causing a NullPointerException that crashes the entire BackupSyncTask background job every sync interval. This adds null checks in both methods: - syncBackupStorageStats: log a warning and return early - deleteBackup: throw CloudRuntimeException with a descriptive message
|
@blueorangutan package |
|
@DaanHoogland 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. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #12805 +/- ##
=============================================
- Coverage 17.61% 3.70% -13.91%
=============================================
Files 5917 448 -5469
Lines 531415 38028 -493387
Branches 64973 7036 -57937
=============================================
- Hits 93588 1409 -92179
+ Misses 427271 36432 -390839
+ Partials 10556 187 -10369
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:
|
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 17121 |
|
@jmsperu , probably due to the rebase: seems an import is missing. |
|
Good catch @DaanHoogland, the CollectionUtils import was dropped during the rebase. Fixed now — should build cleanly. |
Rebased onto 4.22 as requested (previously #12680).
ResourceManager.findOneRandomRunningHostByHypervisor()can return null when no KVM host in the zone has status=Up (e.g. during management server startup, brief agent disconnections, or host state transitions).NASBackupProvider.syncBackupStorageStats()anddeleteBackup()callhost.getId()without a null check, causing a NullPointerException that crashes the entireBackupSyncTaskbackground job every sync interval.This adds null checks in both methods:
CloudRuntimeExceptionwith a descriptive message