Skip to content

Fix for encryption and migration not working on Shared Mount Point#13537

Open
abh1sar wants to merge 1 commit into
apache:4.22from
shapeblue:smp-fixes
Open

Fix for encryption and migration not working on Shared Mount Point#13537
abh1sar wants to merge 1 commit into
apache:4.22from
shapeblue:smp-fixes

Conversation

@abh1sar

@abh1sar abh1sar commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

LibvirtStorageAdapter used to identify the poolType for a Shared mount point storage as StoragePoolType.Filesystem as it derived it from LIbvirt's XML where both Local Storage and SMP map to the PoolType.Dir.

So it used to have the same behaviour as Local Storage and NFS as there are some conditions that only check these two storages:

        if (StoragePoolType.NetworkFilesystem.equals(poolType) || StoragePoolType.Filesystem.equals(poolType)) {

#12773 (4.22.1) changed this to set the poolType as SharedMountPoint.

        if (pool instanceof LibvirtStoragePool) {
            addPoolDetails(uuid, (LibvirtStoragePool) pool);
+            ((LibvirtStoragePool) pool).setType(type);
        }

It causes Shared Mount Point to be excluded from a few places in code.

This creates a few problems:

  1. Encryption not being applied to the volumes .

  2. Qcow2 being created with compat=0.10 or version2 instead of 3.
    This is because disk creation is now being done using createPhysicalDiskByLibVirt instead of createPhysicalDiskByQemuImg

  3. Migrating a VM from NFS to SMP storage fails
    This is because createDiskFromTemplateBacking returns now for SMP

    public KVMPhysicalDisk createDiskFromTemplateBacking(KVMPhysicalDisk template, String name, PhysicalDiskFormat format, long size,
                                                         KVMStoragePool destPool, int timeout, byte[] passphrase) {
        String volumeDesc = String.format("volume [%s], with template backing [%s], in pool [%s] (%s), with size [%s] and encryption is %s", name, template.getName(), destPool.getUuid(),
          destPool.getType(), size, passphrase != null && passphrase.length > 0);

        if (!poolTypesThatEnableCreateDiskFromTemplateBacking.contains(destPool.getType())) {
            logger.info(String.format("Skipping creation of %s due to pool type is none of the following types %s.", volumeDesc, poolTypesThatEnableCreateDiskFromTemplateBacking.stream()
              .map(type -> type.toString()).collect(Collectors.joining(", "))));

            return null;
        }

Fix

Extract NetworkFilesystem/Filesystem/SharedMountPoint into a single QEMU_IMG_MANAGED_POOL_TYPES constant and route SharedMountPoint through the same qemu-img-based creation path as NFS/Filesystem everywhere that set is consulted.

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?

Tested the 3 failing test cases with and without the fix.

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

Copilot AI 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.

Pull request overview

This PR fixes regressions introduced when Shared Mount Point (SMP) storage pools began being identified as StoragePoolType.SharedMountPoint instead of being treated like Filesystem. It restores the qemu-img–managed disk creation/migration/encryption behavior for SMP by routing it through the same decision paths as NetworkFilesystem and Filesystem.

Changes:

  • Introduces QEMU_IMG_MANAGED_POOL_TYPES (NetworkFilesystem, Filesystem, SharedMountPoint) to centralize “qemu-img-managed” pool type decisions.
  • Ensures SMP uses the qemu-img-based paths for template-backing disk creation and physical disk creation (including preallocation options).
  • Updates inline documentation to reflect SMP being part of the qemu-img-managed pool type group.

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

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.66%. Comparing base (21b2025) to head (0c2cf26).
⚠️ Report is 38 commits behind head on 4.22.

Files with missing lines Patch % Lines
.../hypervisor/kvm/storage/LibvirtStorageAdaptor.java 20.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #13537      +/-   ##
============================================
- Coverage     17.67%   17.66%   -0.02%     
+ Complexity    15792    15789       -3     
============================================
  Files          5922     5923       +1     
  Lines        533165   533309     +144     
  Branches      65208    65238      +30     
============================================
- Hits          94242    94204      -38     
- Misses       428276   428460     +184     
+ Partials      10647    10645       -2     
Flag Coverage Δ
uitests 3.69% <ø> (-0.01%) ⬇️
unittests 18.73% <20.00%> (-0.02%) ⬇️

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.

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

Code lgtm

@shwstppr

shwstppr commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr 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]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18456

@weizhouapache

Copy link
Copy Markdown
Member

code lgtm

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File

@DaanHoogland

Copy link
Copy Markdown
Contributor

@abh1sar , more testing needed for this?

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.

6 participants