systemvm: serve cloud-domain and cloud-domain-id from their own metadata files - #14157
Draft
nagaboinaramgopal wants to merge 1 commit into
Draft
systemvm: serve cloud-domain and cloud-domain-id from their own metadata files#14157nagaboinaramgopal wants to merge 1 commit into
nagaboinaramgopal wants to merge 1 commit into
Conversation
…ata files The latest/cloud-domain and latest/cloud-domain-id rewrite rules on the virtual router pointed at the vm-id file, so both returned the VM id instead of the domain name and domain id. The latest/meta-data/cloud-domain paths were not affected.
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.
Description
On the virtual router, the
latest/cloud-domainandlatest/cloud-domain-idrewrite rules insystemvm/debian/var/www/html/latest/.htaccesspoint at thevm-idmetadata file, so a guest asking its router for either gets its VM id instead of the domain name or domain id. The router already writes the rightcloud-domainandcloud-domain-idfiles whenmetadata.allow.expose.domainis enabled, andlatest/meta-data/cloud-domainreturns them correctly through the genericmeta-data/rule. This points each rule at its own file.When the domain is not exposed, the old rules also handed out the VM id for these two paths. With this change they return 404, the same as
latest/meta-data/cloud-domain.configure.py(__htaccess) also appends^cloud-domain$and^cloud-domain-id$rules pointing at the right files when it writes the guest's metadata, but it only appends and never touches the static lines, and the static^cloud-domain/?$rules come first in the file, so they win.The same lines are on 4.20, 4.22 and main, so this targets 4.20.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A
How Has This Been Tested?
Live tested on a KVM zone with an isolated network and a virtual router, requesting the metadata from inside a guest with
wget -qO- http://<router>/latest/<path>. The router picks up.htaccesschanges on the next request, so the fixed file was applied on the running router. Values are shown by what they matched.With
metadata.allow.expose.domain=true, before the change:With the change:
With
metadata.allow.expose.domain=falseand a new guest, before the change:With the change:
The file is part of
cloud-scripts.tgz(the systemvm build copiessystemvm/debian/), so routers get it when they are patched on restart.How did you try to break this feature and the system with this change?
Only the two rules change.
latest/vm-id, the other metadata paths and the genericmeta-data/rule return the same values as before, and user data is not touched.