Skip to content

systemvm: keep /var/www owned by www-data after patching the SSVM - #14727

Open
RosiKyu wants to merge 1 commit into
apache:mainfrom
shapeblue:fix-ssvm-patch-userdata-owner
Open

RosiKyu wants to merge 1 commit into
apache:mainfrom
shapeblue:fix-ssvm-patch-userdata-owner

Conversation

@RosiKyu

@RosiKyu RosiKyu commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Description

After patchSystemVm on the secondary storage VM, creating a new download link (volume, template, ISO) fails with "mkdir: cannot create directory '/var/www/html/userdata/{id}/': Permission denied" until the SSVM is rebooted.

The patch extracts cloud-scripts.tgz as root, and the archive also carries /var/www/html/userdata, so the folder ends up owned by root. The SSVM creates the download folders there as www-data. On boot, setup_apache2 runs chown www-data:www-data -R /var/www, which is why a reboot fixes it.

This PR does the same chown in patch-sysvms.sh right after the extract, for the secondary storage VM only.

Fixes #14726

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

KVM lab on a main nightly (one SSVM, NFS secondary storage). The changed patch-sysvms.sh was put on the KVM host that runs the SSVM, in place of the packaged one.

  • Without the fix: patch the SSVM, then download template T1. It fails with "Permission denied".
  • With the fix: patch the SSVM, then download template T2. The link is created and the file is served (HTTP 206 for a range request). /var/www, /var/www/html and /var/www/html/userdata are owned by www-data after the patch.

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

  • The SSVM agent comes back Up after the patch with the fix.
  • Only the secondary storage VM is changed. The console proxy and routers are patched as before.

Patching the secondary storage VM extracts cloud-scripts.tgz as root,
which also carries /var/www/html/userdata. The folder then belongs to
root and new download links (volumes, templates, ISOs) fail with
"mkdir: cannot create directory ... Permission denied" until the SSVM
is rebooted. Give /var/www back to www-data after the extract, the same
as the boot setup does.

Fixes apache#14726
Copilot AI balanced review requested due to automatic review settings November 18, 2026 11:24
@RosiKyu RosiKyu added this to the 24.0 milestone Nov 18, 2026
@RosiKyu

RosiKyu commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

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.

🟢 Approval recommended

No active review issues are reported for the SSVM web-root ownership fix.

No open issues 🎉

What changed in this PR

Fixes download-link creation after patching a secondary storage VM (SSVM), addressing #14726 without requiring a reboot.

Changes:

  • Restores www-data:www-data ownership recursively under /var/www immediately after extracting the patch archive, matching boot-time setup.
  • Limits the ownership correction to SSVMs, leaving console proxy and router patching unchanged.
File Description
systemvm/​patch-sysvms.sh Restores SSVM web-root ownership after archive extraction so new download directories remain writable.

Review effort: Balanced

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 20.80%. Comparing base (6a0fcd6) to head (7ba2db8).

Additional details and impacted files
@@             Coverage Diff              @@
##              main   #14727       +/-   ##
============================================
+ Coverage     3.86%   20.80%   +16.94%     
- Complexity       0    20920    +20920     
============================================
  Files          494     6053     +5559     
  Lines        42888   548451   +505563     
  Branches      8141    73279    +65138     
============================================
+ Hits          1657   114126   +112469     
- Misses       40999   420960   +379961     
- Partials       232    13365    +13133     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests 22.24% <ø> (?)

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.

@blueorangutan

Copy link
Copy Markdown

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

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

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@RosiKyu

RosiKyu commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@RosiKyu 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-17594)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 59238 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr14727-t17594-kvm-ol8.zip
Smoke tests completed. 157 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@RosiKyu

RosiKyu commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

I tested the PR packages on a KVM lab (one SSVM, NFS secondary storage):

  • Patched the SSVM: "Successfully patched systemVM s-1-VM", agent back Up.
  • Without a reboot, downloaded a volume that was never downloaded before and a template that failed after the patch on main: both links were created and the files were served (HTTP 206 for a range request).
  • Patched the SSVM a second time and downloaded another new volume: works.

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.

Volume download fails with Permission denied after patching the SSVM

5 participants