Skip to content

SSVM: entity download URL creation: ensure userdata base dir exists - #14447

Open
DaanHoogland wants to merge 2 commits into
4.22from
ghi13959-fixSsvmEntityDownloadURL
Open

DaanHoogland wants to merge 2 commits into
4.22from
ghi13959-fixSsvmEntityDownloadURL

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

replaces #13967, as the author won't rebase

When handleCreateEntityURLCommand runs on the SSVM it builds the download URL by creating /var/www/html/userdata// as the www-data user (su www-data -c "mkdir -p ..."). On stock systemvm templates the /var/www/html/userdata base directory does not exist and /var/www/html is not writable by www-data, so the mkdir fails with "Permission denied" and getDiagnosticsData / extractVolume / extractTemplate async jobs error out with code 530 and no download URL is produced.

Fix: create the base extract directory and set its ownership to www-data before dropping privileges to create the per-entity subdirectory. This makes the SSVM self-healing on first use and matches the directory layout expected by the Apache docroot.

Fixes: #13959

Description

This PR...

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?

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.00000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.32%. Comparing base (d02adcd) to head (f5c2384).

Files with missing lines Patch % Lines
...cloudstack/storage/template/UploadManagerImpl.java 45.00% 9 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #14447   +/-   ##
=========================================
  Coverage     18.32%   18.32%           
- Complexity    16644    16647    +3     
=========================================
  Files          5939     5939           
  Lines        537768   537787   +19     
  Branches      65929    65932    +3     
=========================================
+ Hits          98551    98555    +4     
- Misses       428008   428022   +14     
- Partials      11209    11210    +1     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.41% <45.00%> (+<0.01%) ⬆️

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.

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Ensures SSVM download URL creation succeeds on stock templates by creating the missing /var/www/html/userdata/ base directory and making it writable by www-data before creating per-entity extract subdirectories.

Changes:

  • Create the base extract directory (BASE_EXTRACT_PATH) if missing.
  • Set ownership of the base extract directory to www-data:www-data before running mkdir as www-data.
File Description
services/​secondary-storage/​server/​src/​main/​java/​org/​apache/​cloudstack/​storage/​template/​UploadManagerImpl.java Ensures base extract directory exists and is owned by www-data to unblock per-entity directory creation and URL generation.

Review effort: Lite

@sureshanaparti

Copy link
Copy Markdown
Contributor

@DaanHoogland are any of the copilot comments relevant here?

waterWang and others added 2 commits November 9, 2026 14:20
…s and is writable by www-data

When handleCreateEntityURLCommand runs on the SSVM it builds the
download URL by creating /var/www/html/userdata/<uuid>/ as the
www-data user (su www-data -c "mkdir -p ..."). On stock systemvm
templates the /var/www/html/userdata base directory does not exist
and /var/www/html is not writable by www-data, so the mkdir fails
with "Permission denied" and getDiagnosticsData / extractVolume /
extractTemplate async jobs error out with code 530 and no download
URL is produced.

Fix: create the base extract directory and set its ownership to
www-data before dropping privileges to create the per-entity
subdirectory. This makes the SSVM self-healing on first use and
matches the directory layout expected by the Apache docroot.

References #13959
@DaanHoogland
DaanHoogland force-pushed the ghi13959-fixSsvmEntityDownloadURL branch from a926799 to f5c2384 Compare November 9, 2026 13:28
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@sureshanaparti , updated.

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

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

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@blueorangutan

Copy link
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@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

This branch has not been deployed

No deployments
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.

getDiagnosticsData fails: www-data cannot mkdir /var/www/html/userdata on SSVM (Permission denied)

6 participants