teach Propolis a -v flag with Git metadata - #702
Conversation
|
Version in SMBIOS tables aside for now, I like having this available via just |
|
Since this shouldn't actually result in differing versions after live migration (per @pfmooney's comment in #701 (comment)), I'm marking this as ready for review. |
| manufacturer: SmbString::default(), | ||
| product_name: SmbString::default(), | ||
| version: SmbString::try_from(crate::version()) | ||
| .expect("version string should not contain NULs"), |
There was a problem hiding this comment.
If we remove the bhyve API version from the string, we could include this condition as part of the version() unit tests
|
So I'm not sure if we want this going in SMBIOS per se. I get the benefit as a developer, but I'm less sold from a customer perspective. What are the semantics of the version that they should use? Are we committing to the format? This leaks information about the host version in a much more concrete way and I'll admit I expected this to be something about the virtual machine itself or something about the overall system as opposed to the virtualization part of it. For example:
I think if we want to say something about propolis itself, then this would be where we want the actual hardware platform revision to go in as this seems much more about the virtual platform. |
Presently, the BIOS version string in Propolis' SMBIOS tables is hardcoded to a default value. It would be nice to instead use the OVMF version for the BIOS version string. Because Propolis' understanding of bootroms is just a path on the filesystem to some kind of file, it's not aware of the OVMF version, or, indeed, that the bootrom even *is* OVMF (and it could conceivably be anything). Therefore, the bootrom version must be provided externally, such as by the Oxide control plane in the case of `propolis-server`, or by the user when running standalone. This PR adds a config field `bootrom_version` to the TOML config files for `propolis-server` and `propolis-standalone` which can be used to provide a value for the bootrom version string. If the version string is not provided, Propolis will continue to use the current default values. I considered changing the config format to move the `bootrom` path field and `bootrom_version` string field into a `bootrom` table, as in: ```toml [bootrom] path = "/path/to/OVMF_CODE.fd" version = "edk2-stable202402" ``` However, this would break existing configs, and I don't think it's so much nicer than ```toml bootrom = "/path/to/OVMF_CODE.fd" bootrom_version = "edk2-stable202402" ```` to justify breakage. I'm happy to change the format if others disagree. Along with #702, this branch implements the changes described in #701.
Presently, the BIOS version string in Propolis' SMBIOS tables is hardcoded to a default value. It would be nice to instead use the OVMF version for the BIOS version string. Because Propolis' understanding of bootroms is just a path on the filesystem to some kind of file, it's not aware of the OVMF version, or, indeed, that the bootrom even *is* OVMF (and it could conceivably be anything). Therefore, the bootrom version must be provided externally, such as by the Oxide control plane in the case of `propolis-server`, or by the user when running standalone. This PR adds a config field `bootrom_version` to the TOML config files for `propolis-server` and `propolis-standalone` which can be used to provide a value for the bootrom version string. If the version string is not provided, Propolis will continue to use the current default values. I considered changing the config format to move the `bootrom` path field and `bootrom_version` string field into a `bootrom` table, as in: ```toml [bootrom] path = "/path/to/OVMF_CODE.fd" version = "edk2-stable202402" ``` However, this would break existing configs, and I don't think it's so much nicer than ```toml bootrom = "/path/to/OVMF_CODE.fd" bootrom_version = "edk2-stable202402" ```` to justify breakage. I'm happy to change the format if others disagree. Along with #702, this branch implements the changes described in #701.
No particular use case beyond just tracking whether we wanted to hardcode it at all. I do think @rmustacc's point about identifying the "Virtual Platform" revision would make more sense. Either way, there's clearly a couple ways to go here. Thanks for putting this together so quickly @hawkw and I think if we drop the SMBIOS bits it's still worth merging just to have the |
|
I'll go ahead and back out the SMBIOS changes, I agree that it's nice to get commit information in the CLI version output regardless of what we do about SMBIOS. And I think including the bhyve version we were built against, rather than the current version detected at runtime, seems like a good call. |
iximeow
left a comment
There was a problem hiding this comment.
just to note: I think it'd be nice to have this at some point even though we've since gotten programmable type 1 table information. I agree that the SMBIOS version makes more sense as the virtual platform version, but that doesn't preclude making --version a useful CLI argument
Yup, I would be happy to resurrect some of those bits at some point. |
Currently, Propolis, both -server and -standalone, opaquely *run* with no hint available about the provenance of the binary. For binaries that come from product software releases, this is basically fine, as those packages include a sha256 of the packaged Propolis zone and one can work from a binary to a source commit. For any development-time experience, random `propolis-standalone`s we've left around, or VMM binaries one finds on a particularly scrumptious USB stick in a parking lot, a `--version flag telling you where the binary probably came from would go a long way. This branch adds a `build.rs` script that uses [the `vergen` crate][1] to emit information about the Git revision that Propolis was build from. Now, we can generate a version string that describes the git branch, commit hash, and commit depth. This is generated in a `propolis::version()` function, which also includes the detected bhyve and viona API versions at runtime. This results in version strings like: ``` propolis-standalone v0.1.0-930 (DIRTY b428c40) HEAD, bhyve API v18, viona API v6 ``` In addition to the `--version` flag described above, this commit also has propolis-server and propolis-standalone print version information when run in a way that they will later run a VM. In release software this can provide evidence of a propolis-server which generated a log file. For the rest of us, hopefully the log line isn't lost to backscroll if an issue has occurred.. [1]: https://docs.rs/vergen
934eb94 to
90a2bc4
Compare
|
having talked with Eliza i'm cordycepsing this PR into putting version information into non-SMBIOS places |
|
@leftwo 🎁 finally the random propolis-servers that we run on bench sleds will tell us what they are :) |
ixi note: since I'm basically taking the vergen bits Eliza had set up, I'm editing this PR in place after having clipped out the SMBIOS stuff. also it uses vergen 10.0 now rather than 6 or whatever it was. the below is my reworking Eliza's commit a bit given the different integration with the binaries, so it's .. pretty similar to the old one but also different.
Currently, Propolis, both -server and -standalone, opaquely run with no
hint available about the provenance of the binary. For binaries that
come from product software releases, this is basically fine, as those
packages include a sha256 of the packaged Propolis zone and one can work
from a binary to a source commit.
For any development-time experience, random
propolis-standalones we'veleft around, or VMM binaries one finds on a particularly scrumptious USB
stick in a parking lot, a `--version flag telling you where the binary
probably came from would go a long way.
This branch adds a
build.rsscript that uses thevergencrateto emit information about the Git revision that Propolis was build from.
Now, we can generate a version string that describes the git branch,
commit hash, and commit depth. This is generated in a
propolis::version()function, which also includes the detected bhyveand viona API versions at runtime. This results in version strings like:
In addition to the
--versionflag described above, this commit alsohas propolis-server and propolis-standalone print version information
when run in a way that they will later run a VM. In release software
this can provide evidence of a propolis-server which generated a log
file. For the rest of us, hopefully the log line isn't lost to
backscroll if an issue has occurred..
The start of both -server and -standalone logs will now have something like: