Skip to content

Don't call delete volume on store if volume doesn't exist on it#13111

Open
sureshanaparti wants to merge 1 commit intoapache:4.22from
shapeblue:fix-delete-volume-not-on-store
Open

Don't call delete volume on store if volume doesn't exist on it#13111
sureshanaparti wants to merge 1 commit intoapache:4.22from
shapeblue:fix-delete-volume-not-on-store

Conversation

@sureshanaparti
Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti commented May 6, 2026

Description

This PR updates changes to not call delete volume on store if volume doesn't exist on it.

Noticed this issue in the failed xenserver test 'test_02_list_snapshots_with_removed_data_store' in test_snapshots.py.

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?

Successfully deleted volume not created on the primary storage.

BEFORE:

Delete volume fails with error " The uuid you supplied was invalid.", and also doesn't allow to remove the storage pool as non-destroyed volumes exists.

2026-05-06 20:03:00,121 INFO  [c.c.s.VolumeApiServiceImpl] (qtp2038105753-24:[ctx-0c63e636, ctx-6a458984]) (logid:0a3bbd32) Expunging volume Volume {"id":630,"instanceId":null,"name":"Test Volume-JE9STT","uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK"} from Primary data store
2026-05-06 20:03:00,124 DEBUG [o.a.c.s.v.VolumeServiceImpl] (qtp2038105753-24:[ctx-0c63e636, ctx-6a458984]) (logid:0a3bbd32) Marking volume that was never created as destroyed: Volume {"id":630,"instanceId":null,"name":"Test Volume-JE9STT","uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK"}

2026-05-06 20:03:00,141 DEBUG [c.c.a.m.ClusteredAgentManagerImpl] (qtp2038105753-24:[ctx-0c63e636, ctx-6a458984]) (logid:0a3bbd32) Wait time setting on org.apache.cloudstack.storage.command.DeleteCommand is 1800 seconds
2026-05-06 20:03:00,142 DEBUG [c.c.a.m.ClusteredDirectAgentAttache] (qtp2038105753-24:[ctx-0c63e636, ctx-6a458984]) (logid:0a3bbd32) Seq 12-5679602080067635204: Routed from 32988301624164
2026-05-06 20:03:00,142 DEBUG [c.c.a.t.Request] (qtp2038105753-24:[ctx-0c63e636, ctx-6a458984]) (logid:0a3bbd32) Seq 1-5679602080067635204: Sending  { Cmd , MgmtId: 32988301624164, via: 1(pr12001-t16006-xcpng83-xs1), Ver: v1, Flags: 100011, [{"org.apache.cloudstack.storage.command.DeleteCommand":{"data":{"org.apache.cloudstack.storage.to.VolumeObjectTO":{"uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"4a7792fb-c135-3ca2-a5c8-bc7e080d76ba","name":"Test nfs2 primary","id":"9","poolType":"NetworkFilesystem","host":"10.0.32.4","path":"/acs/primary/pr12001-t16006-xcpng83/nfs2","port":"2049","url":"NetworkFilesystem://10.0.32.4/acs/primary/pr12001-t16006-xcpng83/nfs2/?ROLE=Primary&STOREUUID=4a7792fb-c135-3ca2-a5c8-bc7e080d76ba","isManaged":"false"}},"name":"Test Volume-JE9STT","size":"(1.00 GB) 1073741824","volumeId":"630","accountId":"317","format":"VHD","provisioningType":"THIN","poolId":"9","id":"630","hypervisorType":"XenServer","directDownload":"false","deployAsIs":"false","checkpointPaths":[],"checkpointImageStoreUrls":[],"followRedirects":"false"}},"wait":"0","bypassHostMaintenance":"false"}}] }
2026-05-06 20:03:00,143 DEBUG [c.c.a.t.Request] (qtp2038105753-24:[ctx-0c63e636, ctx-6a458984]) (logid:0a3bbd32) Seq 1-5679602080067635204: Executing:  { Cmd , MgmtId: 32988301624164, via: 1(pr12001-t16006-xcpng83-xs1), Ver: v1, Flags: 100011, [{"org.apache.cloudstack.storage.command.DeleteCommand":{"data":{"org.apache.cloudstack.storage.to.VolumeObjectTO":{"uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"4a7792fb-c135-3ca2-a5c8-bc7e080d76ba","name":"Test nfs2 primary","id":"9","poolType":"NetworkFilesystem","host":"10.0.32.4","path":"/acs/primary/pr12001-t16006-xcpng83/nfs2","port":"2049","url":"NetworkFilesystem://10.0.32.4/acs/primary/pr12001-t16006-xcpng83/nfs2/?ROLE=Primary&STOREUUID=4a7792fb-c135-3ca2-a5c8-bc7e080d76ba","isManaged":"false"}},"name":"Test Volume-JE9STT","size":"(1.00 GB) 1073741824","volumeId":"630","accountId":"317","format":"VHD","provisioningType":"THIN","poolId":"9","id":"630","hypervisorType":"XenServer","directDownload":"false","deployAsIs":"false","checkpointPaths":[],"checkpointImageStoreUrls":[],"followRedirects":"false"}},"wait":"0","bypassHostMaintenance":"false"}}] }
2026-05-06 20:03:00,143 DEBUG [c.c.a.m.D.Task] (DirectAgent-267:[ctx-eb1ace39]) (logid:f7c80038) Seq 12-5679602080067635204: Executing request
2026-05-06 20:03:00,143 DEBUG [c.c.s.r.StorageSubsystemCommandHandlerBase] (DirectAgent-267:[ctx-eb1ace39]) (logid:0a3bbd32) Executing command DeleteCommand: [{"data":{"org.apache.cloudstack.storage.to.VolumeObjectTO":{"uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"4a7792fb-c135-3ca2-a5c8-bc7e080d76ba","name":"Test nfs2 primary","id":9,"poolType":"NetworkFilesystem","host":"10.0.32.4","path":"/acs/primary/pr12001-t16006-xcpng83/nfs2","port":2049,"url":"NetworkFilesystem://10.0.32.4/acs/primary/pr12001-t16006-xcpng83/nfs2/?ROLE=Primary&STOREUUID=4a7792fb-c135-3ca2-a5c8-bc7e080d76ba","isManaged":false}},"name":"Test Volume-JE9STT","size":1073741824,"volumeId":630,"accountId":317,"format":"VHD","provisioningType":"THIN","poolId":9,"id":630,"hypervisorType":"XenServer","directDownload":false,"deployAsIs":false,"checkpointPaths":[],"checkpointImageStoreUrls":[],"followRedirects":false}},"wait":0,"bypassHostMaintenance":false}].
2026-05-06 20:03:00,151 DEBUG [c.c.h.x.r.Xenserver625StorageProcessor] (DirectAgent-267:[ctx-eb1ace39]) (logid:0a3bbd32) Failed to delete volume The uuid you supplied was invalid.
	at com.xensource.xenapi.Types.checkResponse(Types.java:2352)
	at com.xensource.xenapi.ConnectionNew.dispatch(ConnectionNew.java:318)
	at com.cloud.hypervisor.xenserver.resource.XenServerConnectionPool$XenServerConnection.dispatch(XenServerConnectionPool.java:459)
	at com.xensource.xenapi.VDI.getByUuid(VDI.java:355)
	at com.cloud.hypervisor.xenserver.resource.XenServerStorageProcessor.deleteVolume(XenServerStorageProcessor.java:587)
...
2026-05-06 20:03:37,729 DEBUG [c.c.s.StorageManagerImpl] (qtp2038105753-24:[ctx-2dd11af0, ctx-d6bc8eab]) (logid:5ea94ed6) Cannot delete storage pool StoragePool {"id":9,"name":"Test nfs2 primary","poolType":"NetworkFilesystem","uuid":"4a7792fb-c135-3ca2-a5c8-bc7e080d76ba"} as the following non-destroyed volumes are on it: [].
2026-05-06 20:03:37,730 ERROR [c.c.a.ApiServer] (qtp2038105753-24:[ctx-2dd11af0, ctx-d6bc8eab]) (logid:5ea94ed6) unhandled exception executing api command: [Ljava.lang.String;@716b52cd com.cloud.utils.exception.CloudRuntimeException: Cannot delete pool StoragePool {"id":9,"name":"Test nfs2 primary","poolType":"NetworkFilesystem","uuid":"4a7792fb-c135-3ca2-a5c8-bc7e080d76ba"} as there are non-destroyed volumes associated to this pool.
	at com.cloud.storage.StorageManagerImpl.deleteDataStoreInternal(StorageManagerImpl.java:1783)
	at com.cloud.storage.StorageManagerImpl.deletePool(StorageManagerImpl.java:1706)

AFTER:

2026-05-06 20:45:23,762 INFO  [c.c.s.VolumeApiServiceImpl] (qtp2038105753-23:[ctx-631e2bf2, ctx-04adee99]) (logid:62cd1e87) Expunging volume Volume {"id":630,"instanceId":null,"name":"Test Volume-JE9STT","uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK"} from Primary data store
2026-05-06 20:45:23,766 DEBUG [o.a.c.s.v.VolumeServiceImpl] (qtp2038105753-23:[ctx-631e2bf2, ctx-04adee99]) (logid:62cd1e87) Marking volume that was never created as destroyed: Volume {"id":630,"instanceId":null,"name":"Test Volume-JE9STT","uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK"}
2026-05-06 20:45:23,784 DEBUG [o.a.c.s.v.VolumeServiceImpl] (qtp2038105753-23:[ctx-631e2bf2, ctx-04adee99]) (logid:62cd1e87) Volume Volume {"id":630,"instanceId":null,"name":"Test Volume-JE9STT","uuid":"6c5a4d4a-c12c-449e-9074-65ac240e5fe8","volumeType":"DATADISK"} doesn't exist on primary storage, no need to delete

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

@sureshanaparti
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sureshanaparti 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
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.68%. Comparing base (3e688b0) to head (9d205c2).

Files with missing lines Patch % Lines
...e/cloudstack/storage/volume/VolumeServiceImpl.java 0.00% 14 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #13111      +/-   ##
============================================
- Coverage     17.68%   17.68%   -0.01%     
  Complexity    15792    15792              
============================================
  Files          5922     5922              
  Lines        533087   533095       +8     
  Branches      65206    65208       +2     
============================================
+ Hits          94269    94270       +1     
- Misses       428176   428184       +8     
+ Partials      10642    10641       -1     
Flag Coverage Δ
uitests 3.69% <ø> (ø)
unittests 18.76% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@sureshanaparti sureshanaparti changed the title Don't call delete volume on store if it doesn't exist on it Don't call delete volume on store if volume doesn't exist on it May 6, 2026
@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17744

@sureshanaparti
Copy link
Copy Markdown
Contributor Author

@blueorangutan test ol9 xcpng83

@blueorangutan
Copy link
Copy Markdown

@sureshanaparti a [SL] Trillian-Jenkins test job (ol9 mgmt + xcpng83) has been kicked to run smoke tests

Copy link
Copy Markdown
Contributor

@sudo87 sudo87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgm

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

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants