Skip to content

Remove agent commands that the management server no longer sends - #14237

Open
wido wants to merge 4 commits into
apache:mainfrom
wido:remove-legacy-storage-commands
Open

wido wants to merge 4 commits into
apache:mainfrom
wido:remove-legacy-storage-commands

Conversation

@wido

@wido wido commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Description

This PR removes agent commands that the management server stopped sending when the storage subsystem was introduced in 4.2, together with every handler for them in the hypervisor resources.

Depends on the KVM cleanup PR #14236, which removes the KVM wrappers for these commands and the ManagedNfsStorageAdaptor. The commits from that branch show up here until it is merged; only the last commit belongs to this PR.

Nothing in the management server creates or subclasses any of these, so the handlers in every hypervisor resource were unreachable:

AttachIsoCommand, BackupSnapshotCommand, CheckConsoleProxyLoadCommand, WatchConsoleProxyLoadCommand, CheckStorageAvailabilityCommand, CreateCommand, CreatePrivateTemplateFromSnapshotCommand, CreatePrivateTemplateFromVolumeCommand, CreateVolumeFromSnapshotCommand, ManageSnapshotCommand, PrimaryStorageDownloadCommand, RebootRouterCommand, UpgradeSnapshotCommand.

Removed with them:

  • the Answer classes only they produced: AttachIsoAnswer, BackupSnapshotAnswer, CreateAnswer, CreateVolumeFromSnapshotAnswer, ManageSnapshotAnswer, CreatePrivateTemplateAnswer. PrimaryStorageDownloadAnswer stays, the KVM storage processor still uses it as a plain failure answer.
  • the XenServer wrappers and the VMware, simulator and console proxy handlers, the corresponding VmwareStorageManager and mock manager methods, and the dispatch branches that routed to them.
  • the execute(PrimaryStorageDownloadCommand) method of the StoragePoolResource interface and the CreateCommand entry in AgentAttache's list of commands refused while connecting.
  • the unit tests in core, XenServer, Hyper-V and KVM that built these commands.
  • the ManagedNFS storage pool type. Its only adaptor is removed in the KVM cleanup PR and no code has ever created a pool of that type.

Not touched, and worth a reviewer's eye:

  • the ovm and ovm3 plugins are not part of the build and still reference these classes.
  • the Hyper-V .NET agent has its own C# handlers for CreateCommand and PrimaryStorageDownloadCommand.
  • log messages and configuration descriptions that merely mention the old command names.

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)
  • 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
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Every command was checked for new X( and extends X across all non-test Java in the tree; none is instantiated or subclassed outside the hypervisor handlers removed here. Non-Java files were searched as well (JSON fixtures, Python, SQL).

api, core, agent, engine/orchestration, the XenServer, Hyper-V, KVM and simulator plugins compile and their unit tests pass with JDK 17. A full-tree mvn -T 1C -Dsimulator test passes: 147 modules, 13,188 tests, 0 failures.

The vmware plugin was not compiled locally. It needs the non-redistributable vSphere SDK, which is not available in the build environment used. Its changes (removal of dispatch branches and the matching handler methods in VmwareResource, VmwareStorageManager(Impl), VmwareSecondaryStorageResourceHandler and VMwareGuru) were reviewed line by line but need the noredist CI build to confirm.

How did you try to break this feature and the system with this change?

Checked that no remaining dispatch chain starts with a removed branch (the console proxy resource and the VMware secondary storage handler both did, and were rewritten so the chain still begins with a valid if), and that no interface method was removed while an implementation still overrides it.

…nger sends

The KVM agent still registered wrappers for a set of commands that date
back to the pre-4.2 storage model. None of these commands is created or
subclassed anywhere in the management server any more, so the wrappers
could never be reached:

  AttachIsoCommand, BackupSnapshotCommand, CheckConsoleProxyLoadCommand,
  WatchConsoleProxyLoadCommand, CheckStorageAvailabilityCommand,
  CreateCommand, CreatePrivateTemplateFromSnapshotCommand,
  CreatePrivateTemplateFromVolumeCommand, CreateVolumeFromSnapshotCommand,
  ManageSnapshotCommand, PrimaryStorageDownloadCommand,
  RebootRouterCommand, UpgradeSnapshotCommand

Along with the wrappers and their shared console proxy base class, this
removes what only they used:

  - the createtmplt.sh and createvm.sh lookups in
    LibvirtComputingResource. The storage processor has its own
    createtmplt.sh lookup; createvm.sh was looked up at startup but never
    executed.
  - the buildTemplateLocation, buildQCOW2Processor and
    retrieveBashScriptPath helpers in LibvirtUtilitiesHelper and the
    BASH_SCRIPT_PATH constant.
  - fields that were declared but never read: heartBeatPath,
    hostOsVersion, javaTempDir, and an unused local in
    getMacAddressToNicNumPair.
  - the 27 unit tests that exercised the removed wrappers.

The Command classes themselves stay in core because the XenServer,
VMware and simulator resources still reference them.
Nothing in the tree references these scripts any more. Nine of them have
no callers at all:

  create_private_template.sh, createvm.sh, delvm.sh, get_domr_kernel.sh,
  get_iqn.sh, importmpl.sh, listvmdisk.sh, listvmdisksize.sh,
  managevolume.sh

createvm.sh was still located at agent startup until the previous
commit, but was never executed.

The other three are stale copies of scripts that live in
scripts/storage/secondary. The secondary storage code resolves them
from that directory only, so the qcow2 copies were never run:

  createvolume.sh, listvmtmplt.sh, listvolume.sh

createtmplt.sh, managesnapshot.sh and resizevolume.sh stay, the KVM
agent still uses them.
  - IvsVifDriver: VIF driver for Big Switch IVS. It could only be
    activated by naming it in libvirt.vif.driver in agent.properties,
    and the Big Switch plugin itself never refers to it.
  - ManagedNfsStorageAdaptor: picked up by the storage adaptor
    reflection scan, but the management server never creates a pool of
    type ManagedNFS, so the adaptor was never selected. The enum value
    is left in place.
  - LibvirtNetworkDef: builder for libvirt <network> XML, never used.
  - KVMGuestOsMapper, KVMStorageResource, StorageAdaptorInfo,
    KVMVirtualDisk: no references anywhere in the tree.
These commands belong to the storage model that predates the storage
subsystem introduced in 4.2. Nothing in the management server creates
or subclasses any of them any more, so the handlers in every hypervisor
resource were unreachable:

  AttachIsoCommand, BackupSnapshotCommand, CheckConsoleProxyLoadCommand,
  WatchConsoleProxyLoadCommand, CheckStorageAvailabilityCommand,
  CreateCommand, CreatePrivateTemplateFromSnapshotCommand,
  CreatePrivateTemplateFromVolumeCommand, CreateVolumeFromSnapshotCommand,
  ManageSnapshotCommand, PrimaryStorageDownloadCommand,
  RebootRouterCommand, UpgradeSnapshotCommand

Removed with them:

  - the Answer classes only they produced: AttachIsoAnswer,
    BackupSnapshotAnswer, CreateAnswer, CreateVolumeFromSnapshotAnswer,
    ManageSnapshotAnswer, CreatePrivateTemplateAnswer.
    PrimaryStorageDownloadAnswer stays, the KVM storage processor still
    uses it as a plain failure answer.
  - the XenServer wrappers and the VMware, simulator and console proxy
    handlers, the corresponding VmwareStorageManager and mock manager
    methods, and the dispatch branches that routed to them.
  - the execute(PrimaryStorageDownloadCommand) method of the
    StoragePoolResource interface and the CreateCommand entry in
    AgentAttache's list of commands refused while connecting.
  - the unit tests in core, XenServer, Hyper-V and KVM that built these
    commands.
  - the ManagedNFS storage pool type. Its only adaptor was removed
    earlier and no code has ever created a pool of that type.

Not touched: the ovm and ovm3 plugins, which are not part of the build
and still reference these classes; the Hyper-V .NET agent, which has its
own C# handlers for CreateCommand and PrimaryStorageDownloadCommand;
and log messages and configuration descriptions that merely mention the
old command names.

The vmware plugin needs the non redistributable vSphere SDK to compile,
which is not available in this build environment; its changes were
reviewed but not compiled.
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.90%. Comparing base (602d9ec) to head (6da46f7).

Files with missing lines Patch % Lines
...nt/resource/consoleproxy/ConsoleProxyResource.java 0.00% 1 Missing ⚠️
...ain/java/com/cloud/hypervisor/guru/VMwareGuru.java 0.00% 1 Missing ⚠️
...esource/VmwareSecondaryStorageResourceHandler.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14237      +/-   ##
============================================
- Coverage     19.91%   19.90%   -0.02%     
+ Complexity    20200    20154      -46     
============================================
  Files          6373     6326      -47     
  Lines        577230   574724    -2506     
  Branches      70696    70489     -207     
============================================
- Hits         114974   114393     -581     
+ Misses       449690   447797    -1893     
+ Partials      12566    12534      -32     
Flag Coverage Δ
uitests 3.71% <ø> (ø)
unittests 21.18% <25.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.

@wido wido added this to the 24.0 milestone Sep 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant