wido opened a new pull request, #14238:
URL: https://github.com/apache/cloudstack/pull/14238

   ### Description
   
   This PR removes methods, fields and private members from the KVM agent 
plugin that have no callers anywhere in the tree, tests included. It is 
independent of the other two cleanup PRs and applies directly to `main`.
   
   The commits are split per class so that individual pieces can be dropped in 
review:
   
   - `LibvirtComputingResource`: `getHostDistro`, `isCentosHost`, 
`isDirectAttachedNetwork`, `isSnapshotSupported`, `post_default_network_rules`, 
`getPoolManager`. The last one shares its name with a function in 
`security_group.py`; the script is still invoked through other paths, only the 
unused Java wrapper for that sub-command goes.
   - `LibvirtVMDef`: twelve getters and setters, plus the fields that only they 
touched and that the generated XML never read (`_kernel`, `_initrd`, `_root`, 
`_cmdline`, `_shareable`, `_deferAttach`, `_hostNetType` and the `HostNicType` 
enum, and the long unused `_ipAddr`).
   - `KVMHABase`: the four `NfsStoragePool` setters, `getHBFile`, `getHBFolder` 
and `runScriptRetry`.
   - Smaller removals in `LibvirtSecretDef` (three getters, the class itself is 
in use), `LibvirtStorageVolumeXMLParser`, `LibvirtStorageAdaptor`, 
`KVMStorageProcessor`, `LibvirtMigrateCommandWrapper`, the two multipath 
adapters, `QemuImg` and `KVMHostInfo`.
   - A final commit removes the private members reported by PMD's 
`UnusedPrivateMethod`, `UnusedPrivateField` and `UnusedLocalVariable` rules, 
each verified by hand. Two PMD findings were false positives (`getPifs`, 
`getOvsPifs` are called) and two write-only fields in `LibvirtVMDef` (`_crash`, 
`_readonly`) were deliberately kept because dropping them would silently turn 
their setters into no-ops.
   
   Methods that are called only by unit tests were intentionally left alone. 
Removing them would mean removing test assertions, and two of them are recent 
CLVM helpers that may belong to in-flight work.
   
   No functional behaviour changes.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [x] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [ ] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [x] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   Each candidate was checked with a whole-word search across every file type 
in the tree, and for same-named declarations elsewhere that could indicate a 
call through an interface or superclass. Two candidates had hits outside their 
file and both turned out to be unrelated (a local variable of the same name in 
`StatsCollector`, and the Python function in `security_group.py`).
   
   After the removals every touched file was scanned for fields that had lost 
their last reference and for unused imports. The KVM plugin compiles with JDK 
17, Checkstyle is clean and the unit tests pass (892 tests, 0 failures). A 
full-tree `mvn -T 1C -Dsimulator test` on the combined cleanup branches passes: 
147 modules, 13,188 tests, 0 failures.
   
   #### How did you try to break this feature and the system with this change?
   
   Ran PMD over the module to cross-check the manual scan, and treated every 
PMD finding as a claim to verify rather than as ground truth; one finding 
(`conn` in `KVMStorageProcessor`) turned out to have a side-effecting 
assignment and was kept.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to