Skip to content

Fix snapshot deletion on template creation failure - #9239

Merged
yadvr merged 2 commits into
apache:4.19from
shapeblue:FixSnapshotDeletionOnTemplateCreationFailure
Sep 4, 2024
Merged

Fix snapshot deletion on template creation failure#9239
yadvr merged 2 commits into
apache:4.19from
shapeblue:FixSnapshotDeletionOnTemplateCreationFailure

Conversation

@harikrishna-patnala

@harikrishna-patnalaharikrishna-patnala commented Jun 13, 2024

Copy link
Copy Markdown
Member

Description

This PR addresses an issue as part of #8946

The issue I've observed is not while taking the snapshot but while creating the template from the snapshot (stack trace also refers the same).

I could not reproduce the original issue of failed snapshot showing as backedup state rather than error (it might have already fixed after 4.17.2), but I saw another serious issue.

The issue is whenever a snapshot is used to create a template or volume and if there is failure in backing up the snapshot to the secondary store and as part of handling that failure MS is deleting the snapshot in primary storage itself.

These changes are introduced as part of the PR #5297

  1. Create a snapshot of a volume (set snapshot.backup.to.secondary = False)
  2. Create a template from that snapshot
  3. As part of the creation, MS first tries to backup the snapshot to the secondary storage
  4. I've made it fail
  5. MS recognized the failure and as part of failure it is deleting the snapshot on the primary storage (also marking the snapshot_store_ref entry for primary store role as "Destroyed")

Here in this PR, the fix is to handle this case of not deleting the snapshot on primary storage.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

First lets check the successful scenario

  1. Create a snapshot of a volume (set snapshot.backup.to.secondary = False)
  2. Create a template from that snapshot
  3. As part of the creation, MS first tries to backup the snapshot to the secondary storage
  4. One new entry in the snapshot_store_ref table will be seen for store_role "Image" in "creating" state
  5. After the successful creation of template, this entry will be deleted.

Now the failure scenario

  1. Create a snapshot of a volume (set snapshot.backup.to.secondary = False)
  2. Create a template from that snapshot
  3. As part of the creation, MS first tries to backup the snapshot to the secondary storage
  4. One new entry in the snapshot_store_ref table will be seen for store_role "Image" in "creating" state
  5. Make the backup operation fail (I've played with the debugger to fail the operation)
  6. Observe the snapshot_store_ref table, this entry will be deleted and also keeps the existing entry for store_role "Primary" as "Ready" state. (Previously this row was marked as "Destroyed")

@harikrishna-patnala
harikrishna-patnalaforce-pushed the FixSnapshotDeletionOnTemplateCreationFailure branch from cfca8f2 to f028a23CompareJune 13, 2024 07:43
@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala 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

codecovBot commented Jun 13, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Project coverage is 14.95%. Comparing base (e2e46e3) to head (680e3c5).
Report is 173 commits behind head on 4.19.

Files with missing linesPatch %Lines
...org/apache/cloudstack/snapshot/SnapshotHelper.java45.45%5 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## 4.19 #9239 +/- ##
============================================
+ Coverage 4.29% 14.95% +10.65% - Complexity 0 11011 +11011 
============================================
Files 363 5378 +5015 Lines 29347 469941 +440594 Branches 5126 59571 +54445 ============================================
+ Hits 1261 70283 +69022 - Misses 27943 391875 +363932 - Partials 143 7783 +7640 
FlagCoverage Δ
uitests4.29% <ø> (-0.01%)⬇️
unittests15.66% <45.45%> (?)

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.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 9919

@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala 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.

@blueorangutan

Copy link
Copy Markdown

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

Comment threadserver/src/main/java/org/apache/cloudstack/snapshot/SnapshotHelper.java Outdated
@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala 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.

@DaanHooglandDaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clgtm

@yadvryadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM didn't test it though

@yadvr
yadvr requested a review from shwstpprJune 18, 2024 07:32
@yadvryadvr added this to the 4.19.1.0 milestone Jun 18, 2024
@blueorangutan

Copy link
Copy Markdown

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

} catch (CloudRuntimeException ex) {
logger.warn(String.format("Unable to delete the temporary snapshot [%s] on secondary storage due to [%s]. We still will expunge the database reference, consider"
+ " manually deleting the file [%s].", snapInfo.getId(), ex.getMessage(), snapInfo.getPath()), ex);
if (!DataStoreRole.Image.equals(snapInfo.getDataStore().getRole())) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

actually still not sure it won't be a potential NPE ; snapInfo is not null but snapInfo.getDataStore() still may be.

@harikrishna-patnalaharikrishna-patnalaJun 18, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Datastore/Role cannot be null based on the existing method calls and it should not be null for further steps as well. Do you want me to keep a check anyways ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe you are right @harikrishna-patnala (probably actually) but in this public method a snapshotInfo object may be passed that is constructed with a null-datastore. I think an extra check does not hurt here.

@yadvr

Copy link
Copy Markdown
Member

@blueorangutan test ol8 kvm-ol8

@blueorangutan

Copy link
Copy Markdown

@rohityadavcloud [SL] unsupported parameters provided. Supported mgmt server os are: centos7, centos6, alma9, suse15, alma8, ubuntu18, ubuntu22, ubuntu20, rocky8, ubuntu24. Supported hypervisors are: kvm-centos6, kvm-centos7, kvm-rocky8, kvm-alma8, kvm-alma9, kvm-ubuntu18, kvm-ubuntu20, kvm-ubuntu22, kvm-ubuntu24, kvm-suse15, vmware-55u3, vmware-60u2, vmware-65u2, vmware-67u3, vmware-70u1, vmware-70u2, vmware-70u3, vmware-80, vmware-80u1, xenserver-65sp1, xenserver-71, xenserver-74, xcpng74, xcpng76, xcpng80, xcpng81, xcpng82

@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@sureshanapartisureshanaparti self-assigned this Jun 26, 2024
@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-10622)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 42446 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9239-t10622-kvm-centos7.zip
Smoke tests completed. 130 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_02_trigger_shutdownFailure336.57test_safe_shutdown.py

@sureshanaparti

Copy link
Copy Markdown
Contributor

@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.

@blueorangutan

Copy link
Copy Markdown

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

@sureshanaparti

Copy link
Copy Markdown
Contributor

@harikrishna-patnala Unable to create volume from the snapshot, Not sure if it's related to this or different issue.

2024-06-27 09:56:52,592 DEBUG [o.a.c.s.s.SnapshotObject] (API-Job-Executor-4:ctx-e580ce2e job-54 ctx-5af933d0) (logid:a539fca6) Failed to update state:com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
2024-06-27 09:56:52,593 DEBUG [o.a.c.s.s.SnapshotServiceImpl] (API-Job-Executor-4:ctx-e580ce2e job-54 ctx-5af933d0) (logid:a539fca6) Failed to copy snapshot
com.cloud.utils.exception.CloudRuntimeException: Failed to update state: com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
at org.apache.cloudstack.storage.snapshot.SnapshotObject.processEvent(SnapshotObject.java:239)
at org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.backupSnapshot(SnapshotServiceImpl.java:357)
at org.apache.cloudstack.storage.snapshot.DefaultSnapshotStrategy.backupSnapshot(DefaultSnapshotStrategy.java:193)
at org.apache.cloudstack.snapshot.SnapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(SnapshotHelper.java:146)
at org.apache.cloudstack.engine.orchestration.VolumeOrchestrator.createVolumeFromSnapshot(VolumeOrchestrator.java:565)
2024-06-27 09:56:52,598 DEBUG [o.a.c.s.SnapshotHelper] (API-Job-Executor-4:ctx-e580ce2e job-54 ctx-5af933d0) (logid:a539fca6) Expunge template for Snapshot [2] is called for primary storage role. Not expunging it, but we will still expunge the database reference of the snapshot for image storage role if any
2024-06-27 09:56:52,625 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-4:ctx-e580ce2e job-54) (logid:a539fca6) Unexpected exception while executing org.apache.cloudstack.api.command.admin.volume.CreateVolumeCmdByAdmin
com.cloud.utils.exception.CloudRuntimeException: Failed to create volume: be56269c-a6b7-4b80-b3f6-6e921eec79fe
at com.cloud.storage.VolumeApiServiceImpl.createVolume(VolumeApiServiceImpl.java:1060)
at com.cloud.storage.VolumeApiServiceImpl.createVolume(VolumeApiServiceImpl.java:241)
...
Caused by: com.cloud.utils.exception.CloudRuntimeException: Failed to copy snapshot:com.cloud.utils.exception.CloudRuntimeException: Failed to update state: com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
at org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.backupSnapshot(SnapshotServiceImpl.java:382)
at org.apache.cloudstack.storage.snapshot.DefaultSnapshotStrategy.backupSnapshot(DefaultSnapshotStrategy.java:193)
at org.apache.cloudstack.snapshot.SnapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(SnapshotHelper.java:146)
2024-06-27 09:56:52,627 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-4:ctx-e580ce2e job-54) (logid:a539fca6) Complete async job-54, jobStatus: FAILED, resultCode: 530, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530","errortext":"Failed to create volume: be56269c-a6b7-4b80-b3f6-6e921eec79fe"}

@sureshanapartisureshanaparti modified the milestones: 4.19.1.0, 4.19.2.0Jun 28, 2024
@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

@sureshanaparti thanks for testing.

But I could not reproduce the issue with a new environment

I've 2 snapshots from two disks one with backup and one without
image

I've created 2 volumes and templates from those two snapshots
image

I've also created 2 templates from those two snapshots
image

They are successful, can you please try again testing @sureshanaparti

@yadvryadvr modified the milestones: 4.19.2.0, 4.19.1.0Jul 11, 2024
@sureshanaparti

Copy link
Copy Markdown
Contributor

@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.

@blueorangutan

Copy link
Copy Markdown

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

@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@sureshanaparti

sureshanaparti commented Jul 15, 2024

Copy link
Copy Markdown
Contributor

@harikrishna-patnala Unable to create template and volume from the backed up snapshot, check whether this is related to the same issue or not (seems root cause for both are the same, calling backupSnapshot() for already backed up snapshot). Able to create template and volume from the non-backed up snapshot - entry created in snapshot_store_ref table during copy and deleted after that.

Create template log =>

2024-07-15 07:17:32,499 DEBUG [o.a.c.s.s.SnapshotObject] (API-Job-Executor-5:ctx-24db41c0 job-51 ctx-b79ad463) (logid:e9288858) Failed to update state:com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
2024-07-15 07:17:32,500 DEBUG [o.a.c.s.s.SnapshotServiceImpl] (API-Job-Executor-5:ctx-24db41c0 job-51 ctx-b79ad463) (logid:e9288858) Failed to copy snapshot
com.cloud.utils.exception.CloudRuntimeException: Failed to update state: com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
at org.apache.cloudstack.storage.snapshot.SnapshotObject.processEvent(SnapshotObject.java:239)
at org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.backupSnapshot(SnapshotServiceImpl.java:357)
at org.apache.cloudstack.storage.snapshot.DefaultSnapshotStrategy.backupSnapshot(DefaultSnapshotStrategy.java:193)
at org.apache.cloudstack.snapshot.SnapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(SnapshotHelper.java:146)
at com.cloud.template.TemplateManagerImpl.createPrivateTemplate(TemplateManagerImpl.java:1681)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy236.createPrivateTemplate(Unknown Source)
at org.apache.cloudstack.api.command.user.template.CreateTemplateCmd.execute(CreateTemplateCmd.java:297)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:172)
at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:112)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:654)
at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:602)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
2024-07-15 07:17:32,506 DEBUG [c.c.r.ResourceLimitManagerImpl] (API-Job-Executor-5:ctx-24db41c0 job-51 ctx-b79ad463) (logid:e9288858) Updating resource Type = template count for Account = 2 Operation = decreasing Amount = 1
2024-07-15 07:17:32,508 DEBUG [c.c.r.ResourceLimitManagerImpl] (API-Job-Executor-5:ctx-24db41c0 job-51 ctx-b79ad463) (logid:e9288858) Updating resource Type = secondary_storage count for Account = 2 Operation = decreasing Amount = (8.00 GB) 8589934592
2024-07-15 07:17:32,512 DEBUG [o.a.c.s.SnapshotHelper] (API-Job-Executor-5:ctx-24db41c0 job-51 ctx-b79ad463) (logid:e9288858) Expunge template for Snapshot [1] is called for primary storage role. Not expunging it, but we will still expunge the database reference of the snapshot for image storage role if any
2024-07-15 07:17:32,524 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-5:ctx-24db41c0 job-51) (logid:e9288858) Unexpected exception while executing org.apache.cloudstack.api.command.admin.template.CreateTemplateCmdByAdmin
com.cloud.utils.exception.CloudRuntimeException: Failed to copy snapshot:com.cloud.utils.exception.CloudRuntimeException: Failed to update state: com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
at org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.backupSnapshot(SnapshotServiceImpl.java:382)
at org.apache.cloudstack.storage.snapshot.DefaultSnapshotStrategy.backupSnapshot(DefaultSnapshotStrategy.java:193)
at org.apache.cloudstack.snapshot.SnapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(SnapshotHelper.java:146)
at com.cloud.template.TemplateManagerImpl.createPrivateTemplate(TemplateManagerImpl.java:1681)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy236.createPrivateTemplate(Unknown Source)
at org.apache.cloudstack.api.command.user.template.CreateTemplateCmd.execute(CreateTemplateCmd.java:297)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:172)
at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:112)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:654)
at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:602)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
2024-07-15 07:17:32,526 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-5:ctx-24db41c0 job-51) (logid:e9288858) Complete async job-51, jobStatus: FAILED, resultCode: 530, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530","errortext":"Failed to copy snapshot:com.cloud.utils.exception.CloudRuntimeException: Failed to update state: com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested"}

Create volume log =>

2024-07-15 07:24:23,234 DEBUG [o.a.c.s.s.SnapshotObject] (API-Job-Executor-6:ctx-479e5ef7 job-52 ctx-d1ee714c) (logid:2227ec93) Failed to update state:com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
2024-07-15 07:24:23,235 DEBUG [o.a.c.s.s.SnapshotServiceImpl] (API-Job-Executor-6:ctx-479e5ef7 job-52 ctx-d1ee714c) (logid:2227ec93) Failed to copy snapshot
com.cloud.utils.exception.CloudRuntimeException: Failed to update state: com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
at org.apache.cloudstack.storage.snapshot.SnapshotObject.processEvent(SnapshotObject.java:239)
at org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.backupSnapshot(SnapshotServiceImpl.java:357)
at org.apache.cloudstack.storage.snapshot.DefaultSnapshotStrategy.backupSnapshot(DefaultSnapshotStrategy.java:193)
at org.apache.cloudstack.snapshot.SnapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(SnapshotHelper.java:146)
at org.apache.cloudstack.engine.orchestration.VolumeOrchestrator.createVolumeFromSnapshot(VolumeOrchestrator.java:565)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy241.createVolumeFromSnapshot(Unknown Source)
at com.cloud.storage.VolumeApiServiceImpl.createVolumeFromSnapshot(VolumeApiServiceImpl.java:1082)
at com.cloud.storage.VolumeApiServiceImpl.createVolume(VolumeApiServiceImpl.java:1032)
at com.cloud.storage.VolumeApiServiceImpl.createVolume(VolumeApiServiceImpl.java:241)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy247.createVolume(Unknown Source)
at org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd.execute(CreateVolumeCmd.java:226)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:172)
at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:112)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:654)
at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:602)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
2024-07-15 07:24:23,247 DEBUG [o.a.c.s.SnapshotHelper] (API-Job-Executor-6:ctx-479e5ef7 job-52 ctx-d1ee714c) (logid:2227ec93) Expunge template for Snapshot [1] is called for primary storage role. Not expunging it, but we will still expunge the database reference of the snapshot for image storage role if any
2024-07-15 07:24:23,273 DEBUG [c.c.r.ResourceLimitManagerImpl] (API-Job-Executor-6:ctx-479e5ef7 job-52 ctx-d1ee714c) (logid:2227ec93) Updating resource Type = volume count for Account = 2 Operation = decreasing Amount = 1
2024-07-15 07:24:23,280 DEBUG [c.c.r.ResourceLimitManagerImpl] (API-Job-Executor-6:ctx-479e5ef7 job-52 ctx-d1ee714c) (logid:2227ec93) Updating resource Type = primary_storage count for Account = 2 Operation = decreasing Amount = (8.00 GB) 8589934592
2024-07-15 07:24:23,295 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-6:ctx-479e5ef7 job-52) (logid:2227ec93) Unexpected exception while executing org.apache.cloudstack.api.command.admin.volume.CreateVolumeCmdByAdmin
com.cloud.utils.exception.CloudRuntimeException: Failed to create volume: 3b6b9ce1-d7cf-45c6-94bf-1d37d70929b4
at com.cloud.storage.VolumeApiServiceImpl.createVolume(VolumeApiServiceImpl.java:1060)
at com.cloud.storage.VolumeApiServiceImpl.createVolume(VolumeApiServiceImpl.java:241)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy247.createVolume(Unknown Source)
at org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd.execute(CreateVolumeCmd.java:226)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:172)
at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:112)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:654)
at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:602)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.cloud.utils.exception.CloudRuntimeException: Failed to copy snapshot:com.cloud.utils.exception.CloudRuntimeException: Failed to update state: com.cloud.utils.fsm.NoTransitionException: Unable to transition to a new state from Ready via CreateOnlyRequested
at org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.backupSnapshot(SnapshotServiceImpl.java:382)
at org.apache.cloudstack.storage.snapshot.DefaultSnapshotStrategy.backupSnapshot(DefaultSnapshotStrategy.java:193)
at org.apache.cloudstack.snapshot.SnapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(SnapshotHelper.java:146)
... 45 more
2024-07-15 07:24:23,299 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-6:ctx-479e5ef7 job-52) (logid:2227ec93) Complete async job-52, jobStatus: FAILED, resultCode: 530, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530","errortext":"Failed to create volume: 3b6b9ce1-d7cf-45c6-94bf-1d37d70929b4"}

@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

checking @sureshanaparti , thanks

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-10831)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 44824 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9239-t10831-kvm-centos7.zip
Smoke tests completed. 132 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File

@vladimirpetrovvladimirpetrov self-assigned this Aug 20, 2024
@yadvr
yadvr merged commit 601e9b6 into apache:4.19Sep 4, 2024
@yadvr
yadvr deleted the FixSnapshotDeletionOnTemplateCreationFailure branch September 4, 2024 06:44
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Sep 6, 2024
* Don't delete the snapshot itself on the primary storage upon any failure
* Change an if condition
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed Volume Snapshot shows State as BackedUp

6 participants

@harikrishna-patnala@blueorangutan@yadvr@sureshanaparti@DaanHoogland@vladimirpetrov