Skip to content

Conversation

@weizhouapache
Copy link
Member

Description

This PR fixes #9440

The ROOT volume of vm from ISO does not have template_id (which is NULL)
We can get the template_id of vm_instance instead

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?

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

@weizhouapache weizhouapache linked an issue Apr 14, 2025 that may be closed by this pull request
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@DaanHoogland
Copy link
Contributor

@weizhouapache , I think we can suffice with a unit test for this one, do you agree?

@codecov
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.18%. Comparing base (8230f04) to head (b1a6ef9).
⚠️ Report is 2 commits behind head on 4.20.

Files with missing lines Patch % Lines
...ain/java/com/cloud/hypervisor/guru/VMwareGuru.java 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #10705      +/-   ##
============================================
- Coverage     16.18%   16.18%   -0.01%     
+ Complexity    13305    13301       -4     
============================================
  Files          5657     5657              
  Lines        498467   498471       +4     
  Branches      60491    60492       +1     
============================================
- Hits          80696    80659      -37     
- Misses       408790   408837      +47     
+ Partials       8981     8975       -6     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.03% <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.

@weizhouapache
Copy link
Member Author

@weizhouapache , I think we can suffice with a unit test for this one, do you agree?

yes, will add @DaanHoogland

Copy link
Contributor

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

code LGTM

@weizhouapache weizhouapache marked this pull request as ready for review April 15, 2025 12:42
@weizhouapache
Copy link
Member Author

weizhouapache commented Apr 17, 2025

@weizhouapache , I think we can suffice with a unit test for this one, do you agree?

yes, will add @DaanHoogland

it seems it needs much effort to add the unit test,as the VMGuruTest does not have unit test for getImportingVMTemplate method
I will not do it now
cc @DaanHoogland

@rohityadavcloud rohityadavcloud added this to the 4.19.3 milestone May 9, 2025
@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

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

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

As this is for veeam, wil we settle for regression testing, @weizhouapache ?

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member Author

As this is for veeam, wil we settle for regression testing, @weizhouapache ?

I think we should test with veeam at least.

@blueorangutan
Copy link

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

Test Result Time (s) Test File
test_01_secure_vm_migration Error 134.63 test_vm_life_cycle.py
test_01_secure_vm_migration Error 134.63 test_vm_life_cycle.py

@weizhouapache weizhouapache modified the milestones: 4.19.4, 4.20.2 Sep 2, 2025
Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

clgtm

@weizhouapache
Copy link
Member Author

moving to 4.20.3 due to inactivity

@weizhouapache weizhouapache modified the milestones: 4.20.2, 4.20.3 Sep 15, 2025
@DaanHoogland DaanHoogland modified the milestones: 4.20.2, 4.20.3 Oct 10, 2025
@abh1sar
Copy link
Collaborator

abh1sar commented Nov 7, 2025

@weizhouapache Could you please rebase this to 4.20?
I've reproduced the issue on a veeam env in 4.20, I can test and verify the fix.

@weizhouapache weizhouapache changed the base branch from 4.19 to 4.20 November 7, 2025 07:49
@weizhouapache weizhouapache force-pushed the 4.19-veeam-restore-vm-from-iso branch from 2791ec5 to b1a6ef9 Compare November 7, 2025 07:50
@weizhouapache
Copy link
Member Author

weizhouapache commented Nov 7, 2025

@weizhouapache Could you please rebase this to 4.20? I've reproduced the issue on a veeam env in 4.20, I can test and verify the fix.

@abh1sar sure,done
thanks for the testing

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

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

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

Copy link
Collaborator

@abh1sar abh1sar left a comment

Choose a reason for hiding this comment

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

Tested with Veeam 12.3.

  1. Created an Instance using ISO.
  2. Took Backup
  3. Stopped Instance
  4. Restore the backup

Before Fix:

VMware] due to: [Cannot invoke "java.lang.Long.longValue()" because the return value of "com.cloud.hypervisor.guru.VMwareGuru.getImportingVMTemplate(java.util.List, long, com.cloud.hypervisor.vmware.mo.DatacenterMO, String, java.lang.Long, long, java.util.Map, org.apache.cloudstack.backup.Backup)" is null]. java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "com.cloud.hypervisor.guru.VMwareGuru.getImportingVMTemplate(java.util.List, long, com.cloud.hypervisor.vmware.mo.DatacenterMO, String, java.lang.Long, long, java.util.Map, org.apache.cloudstack.backup.Backup)" is null
        at com.cloud.hypervisor.guru.VMwareGuru.importVirtualMachineFromBackup(VMwareGuru.java:1176)
        at org.apache.cloudstack.backup.BackupManagerImpl.importRestoredVM(BackupManagerImpl.java:600)
        at org.apache.cloudstack.backup.BackupManagerImpl.restoreBackup(BackupManagerImpl.java:666)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        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:109)
        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 jdk.proxy3/jdk.proxy3.$Proxy371.restoreBackup(Unknown Source)
        at org.apache.cloudstack.api.command.user.backup.RestoreBackupCmd.execute(RestoreBackupCmd.java:77)
        at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:173)
        at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:110)
        at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:661)
        at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
        at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
        at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:609)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:840)

After Fix:
Restored finished without any error.

2025-11-07 10:42:09,483 DEBUG [c.c.a.ApiServer] (API-Job-Executor-13:[ctx-adc78ab9, job-66, ctx-894693c6]) (logid:6fb9f493) Retrieved cmdEventType from job info: BACKUP.RESTORE
2025-11-07 10:42:09,484 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl$5] (API-Job-Executor-13:[ctx-adc78ab9, job-66]) (logid:6fb9f493) Done executing org.apache.cloudstack.api.command.user.backup.RestoreBackupCmd for job-66

@DaanHoogland DaanHoogland merged commit 2954e96 into apache:4.20 Nov 7, 2025
25 of 26 checks passed
@DaanHoogland DaanHoogland deleted the 4.19-veeam-restore-vm-from-iso branch November 7, 2025 11:50
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.

Veeam Backup => Assign Backup Problem

8 participants