fix: SSVM entity download URL creation: ensure userdata base dir exists and is writable by www-data - #13967
Open
waterWang wants to merge 1 commit into
Open
Conversation
…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 apache#13959
Contributor
|
@waterWang , please rebase on 4.22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
handleCreateEntityURLCommandruns on the SSVM (Secondary Storage VM) to build a download URL for e.g.getDiagnosticsData, it creates/var/www/html/userdata/<uuid>/as thewww-datauser viasu www-data -c "mkdir -p ...". On stock systemvm templates (systemvm-kvm-4.22.0) the/var/www/html/userdatabase directory does not exist, and/var/www/htmlis not writable bywww-data, so themkdirfails with:This affects
getDiagnosticsData,extractVolume,extractTemplateand any other operation that callsCreateEntityDownloadURLCommand.Fix
Create the base extract directory (
/var/www/html/userdata/) and set its ownership towww-data:www-databefore the privilege-droppedsu www-datacall that creates the per-entity subdirectory. This self-heals the SSVM on first use -- the directory is created by the root process that owns the service, then handed over towww-datafor the downstream Apache docroot operations.Changes
UploadManagerImpl.java--handleCreateEntityURLCommand: addmkdir -p BASE_EXTRACT_PATH && chown www-data:www-data BASE_EXTRACT_PATHbefore the existingsu www-datasubdirectory creation.+12 / -1 lines.
Closes #13959