Skip to content

Conversation

sudo87
Copy link
Collaborator

@sudo87 sudo87 commented Oct 3, 2025

Description

This PR enables support for xz format templates #7701

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?

Copy link

codecov bot commented Oct 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.60%. Comparing base (b09f3e8) to head (1e5a903).
⚠️ Report is 3 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (b09f3e8) and HEAD (1e5a903). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (b09f3e8) HEAD (1e5a903)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #11786       +/-   ##
=============================================
- Coverage     17.50%    3.60%   -13.90%     
=============================================
  Files          5894      442     -5452     
  Lines        526880    37265   -489615     
  Branches      64338     6836    -57502     
=============================================
- Hits          92243     1345    -90898     
+ Misses       424260    35757   -388503     
+ Partials      10377      163    -10214     
Flag Coverage Δ
uitests 3.60% <ø> (-0.01%) ⬇️
unittests ?

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.

@sudo87
Copy link
Collaborator Author

sudo87 commented Oct 3, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 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 15279

@harikrishna-patnala
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-14524)

@sudo87
Copy link
Collaborator Author

sudo87 commented Oct 7, 2025

@blueorangutan package

@blueorangutan
Copy link

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

@vishesh92 vishesh92 requested a review from Copilot October 7, 2025 12:38
Copy link
Contributor

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

Adds support for xz-compressed templates across utilities, KVM adaptors, and shell scripts to enable template registration and extraction of .xz files.

  • Extend compression format detection to include xz
  • Add extraction logic for .xz in KVM adaptors and shell scripts
  • Update unit tests to cover xz handling

Reviewed Changes

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

Show a summary per file
File Description
utils/src/main/java/com/cloud/utils/UriUtils.java Adds "xz" to COMPRESSION_FORMATS for URL detection.
utils/src/test/java/com/cloud/utils/UriUtilsTest.java Adds a positive assertion for xz URLs.
utils/src/test/java/com/cloud/utils/UriUtilsParametrizedTest.java Removes ".xz" from illegal formats; tests configuration updated.
tools/devcloud4/common/development-installation/files/default/createtmplt.sh Adds XZ detection and decompression in helper script.
scripts/storage/secondary/createvolume.sh Adds XZ detection and decompression.
scripts/storage/secondary/createtmplt.sh Adds XZ detection and decompression.
scripts/storage/qcow2/createvolume.sh Adds XZ decompression.
scripts/storage/qcow2/createtmplt.sh Adds XZ decompression.
scripts/installer/createvolume.sh Adds XZ decompression.
scripts/installer/createtmplt.sh Adds XZ decompression.
plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStorageAdaptor.java Adds xz to extractable types and extraction command.
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java Adds xz to extractable types and extraction command.
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/MultipathSCSIAdapterBase.java Adds xz to extractable types and extraction command.
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java Adds xz to extractable types and extraction command.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 551 to 557
} else if (downloadedTemplateFile.endsWith(".gz")) {
return "gunzip -c " + downloadedTemplateFile + " > " + templateFile;
} else if (downloadedTemplateFile.endsWith(".xz")) {
return "xz -d -c " + downloadedTemplateFile + " > " + templateFile;
} else {
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile);
}
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

isTemplateExtractable() treats ZIP as extractable, but getExtractCommandForDownloadedFile() has no branch for ".zip", which will cause ZIP files to hit the exception path. Add ZIP handling consistent with other scripts, for example: return "unzip -p " + downloadedTemplateFile + " > " + templateFile;

Copilot uses AI. Check for mistakes.

Comment on lines 625 to 631
} else if (downloadedTemplateFile.endsWith(".gz")) {
return "gunzip -c " + downloadedTemplateFile + " > " + templateFile;
} else if (downloadedTemplateFile.endsWith(".xz")) {
return "xz -d -c " + downloadedTemplateFile + " > " + templateFile;
} else {
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile);
}
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

ZIP is considered extractable in isTemplateExtractable(), but there is no extraction branch for ".zip" here. Add ZIP extraction support to avoid throwing for valid ZIP templates, e.g., return "unzip -p " + downloadedTemplateFile + " > " + templateFile;

Copilot uses AI. Check for mistakes.

Comment on lines 438 to 444
} else if (downloadedTemplateFile.endsWith(".gz")) {
return "gunzip -c " + downloadedTemplateFile + " > " + templateFile;
} else if (downloadedTemplateFile.endsWith(".xz")) {
return "xz -d -c " + downloadedTemplateFile + " > " + templateFile;
} else {
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile);
}
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

ZIP is allowed by isTemplateExtractable(), but ".zip" is not handled here, leading to an exception for ZIP templates. Add a ZIP case similar to other formats, e.g., return "unzip -p " + downloadedTemplateFile + " > " + templateFile;

Copilot uses AI. Check for mistakes.

Comment on lines 195 to 201
} else if (downloadedTemplateFile.endsWith(".gz")) {
return "gunzip -c " + downloadedTemplateFile + " > " + templateUuid;
} else if (downloadedTemplateFile.endsWith(".xz")) {
return "xz -d -c " + downloadedTemplateFile + " > " + templateUuid;
} else {
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile);
}
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

ZIP archives are flagged as extractable in isTemplateExtractable(), but there is no handling for ".zip" here, which will cause a runtime exception. Add a ZIP branch, e.g., return "unzip -p " + downloadedTemplateFile + " > " + templateUuid;

Copilot uses AI. Check for mistakes.

;;
[zZ][iI][pP]) unzip -p $1 | cat > $tmpfile
;;
XZ) xz -d -c $1 > $tmpfile
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a case sensitive check. Use [xX][zZ] to match xz, XZ, xZ & Xz.

@blueorangutan
Copy link

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

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.

4 participants