Skip to content

[Veeam] Fix create new instance from backup using VSAN storage#13203

Open
nvazquez wants to merge 1 commit into
apache:4.22from
shapeblue:422-veeam-vsan-fix
Open

[Veeam] Fix create new instance from backup using VSAN storage#13203
nvazquez wants to merge 1 commit into
apache:4.22from
shapeblue:422-veeam-vsan-fix

Conversation

@nvazquez
Copy link
Copy Markdown
Contributor

Description

This PR fixes creation of VM from backup using VSAN storage.

Fixes: #11888

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?

@nvazquez
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@nvazquez 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 21, 2026

Codecov Report

❌ Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.67%. Comparing base (35ac91e) to head (ef97500).

Files with missing lines Patch % Lines
...rg/apache/cloudstack/backup/veeam/VeeamClient.java 0.00% 3 Missing ⚠️
...rg/apache/cloudstack/backup/BackupManagerImpl.java 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #13203   +/-   ##
=========================================
  Coverage     17.67%   17.67%           
- Complexity    15788    15789    +1     
=========================================
  Files          5922     5922           
  Lines        533121   533131   +10     
  Branches      65201    65203    +2     
=========================================
+ Hits          94240    94246    +6     
- Misses       428236   428239    +3     
- Partials      10645    10646    +1     
Flag Coverage Δ
uitests 3.69% <ø> (ø)
unittests 18.75% <53.84%> (+<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.

@blueorangutan
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Veeam-based VM restore/create-from-backup flows on VMware when the target datastore must be identified by datastore name (not the CloudStack UUID), which is required for vSAN/VMFS scenarios (issue #11888).

Changes:

  • Add BackupManagerImpl.getDatastorePossibleValues(...) to prefer datastore name for VMFS pools and keep UUID+name fallbacks for other pool types.
  • Update VM restore paths to use the new datastore identifier selection logic.
  • Adjust Veeam PowerShell datastore identifier handling to only strip hyphens when the input is an actual UUID; add unit tests for datastore selection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java Uses datastore-name-first logic for VMFS and centralizes datastore identifier selection for restore operations.
server/src/test/java/org/apache/cloudstack/backup/BackupManagerTest.java Adds tests for the new datastore-possible-values behavior.
plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java Prevents unintended mutation of datastore names (e.g., removing -) while keeping UUID normalization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +910 to +912
final String datastoreId = UuidUtils.isUuid(dataStoreUuid) ?
dataStoreUuid.replace("-","") :
dataStoreUuid;

/**
* For VMFS datastores, the identifier to be used for Veeam restore is the datastore name.
* Otherwise, possible values are the datastore UUID and the datastore name..
Comment on lines +2262 to +2268
@Test
public void testGetDatastorePossibleValuesVSAN() {
String poolName = "VSAN-Pool-Name";

StoragePoolVO pool = Mockito.mock(StoragePoolVO.class);
when(pool.getPoolType()).thenReturn(Storage.StoragePoolType.VMFS);
when(pool.getName()).thenReturn(poolName);
@vishesh92
Copy link
Copy Markdown
Member

@nvazquez please check if the copilot's comments are valid or not.

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.

Failed to create a new instance from backup with Veeam using vSAN storage

4 participants