-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nocloud: add support for dmi variable expansion for seedfrom URL #1879
nocloud: add support for dmi variable expansion for seedfrom URL #1879
Conversation
One thing i noticed, We probably want to add a note about when this feature was added in docs. Since it might cause confusion when people use older images that dont have support for it. Otherwise LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. I left some comments inline.
Oh, also docs linting doesn't like a few line lengths. |
There is a possibility that this breaks someone out there using a similar URL scheme in their current deployments, right? For example if someone has deployments that pass in It would be a weird coincidence, but we have no way of knowing someone isn't doing this. There is the case for encoding / special characters in URLs and the fact that this PR hasn't settled on whether to use |
317ca16
to
8391145
Compare
in an environment like libvirt, how would i set these variables for testing this code? |
5d614b0
to
5a7308b
Compare
So i just spoke with a friend in another company today about this. Auto adding the / is going to break some existing usecases. His seedfrom url is something like In this case adding a slash automatically is going to at minimum need him to update his code to strip a prefixing slash from the filename param value but is effectively a breaking change to his usecase. I doubt hes the only one I guess we could add a check to see if the last character is an |
or more generally: is there's a query string in the URI, there's no need to append a |
5a7308b
to
9a9726d
Compare
Thanks @holmanb for the thoughtful suggestion here. Through the course of this PR, we ended up dropping support for other kenv keys which happened to contain underscores
By making this a dunder marker instead of just a single character. I think we've probably insulated ourselves from most usefuls corner cases for use of a |
8a4a748
to
6f45161
Compare
Left two inline comments, but overall LGTM. If we're going to patch out the trailing slash in our SRUs, I'll plug going the feature flag route again, which I think would make the most sense to add in this PR. |
613a0b0
to
ceb90ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since rtd is faling anyway, one small nit left that somehow didn't get posted yesterday.
ac0795a
to
db2b414
Compare
NoCloud meta-data seedfrom (or kernel commandline seedfrom) URL can now provide variable expansion for system-specific DMI values as seen in /sys/class/dmi/id on Linux or kenv on FreeBSD platforms. Variable names of the format %dmi.SOME_VAR% will be replaced when determining the URL from which NoCloud datasource GETs its user-data and meta-data. This allows for a common templated seedfrom URL which can be reused for mass deployments, but can allow for unique URLs based on classes of DMI system characteristics such as chassis serial, product name, UUID etc.
The %dmi.varnames% to support from nocloud seedurl will be distro-agnostic DMI strings, seen from `dmidecode -s`. Avoid supporting distro-specialized variable names like those from sys/class/dmi/id on Linux or kenv vars from FreeBSD. Update docs dropping distro-specific dmi.<varname>.
If NoCloud have a seedfrom base which doesn't contain a '%s' token, or a query string, ensure the end of the base url has a trailing forward slash. Previously if NoCloud seedfrom=http://something didn't end with a trailing forward slash, the URLs that would be queried would lack path component separators: http://somethingmeta-data http://somethinguser-data http://somethingvendor-data Allow util.read_seeded to append the trailing forward slash when needed. This allows appending kernel commandline params to be as brief as possible when providing `ds=nocloud-net;s=http://someurl` read_seeded will not append a forward slash when '%s' is present because that token is a placeholder in a string format which is expected to be a fully resolvable well-formed URL path.
This will use URL-safe characters, avoid Grub variable expansion, avoid interaction with any python %-formatting operations and avoid most collisions with any common URL paths.
db2b414
to
c07722d
Compare
Proposed Commit Message
Additional Context
Test Steps
Checklist: