[mic][iso] generate PXE-bootable ISO images.#10595
Conversation
f2825b8 to
d6fd3b9
Compare
e5ee6be to
39eea29
Compare
0fd9990 to
c9ba796
Compare
…distro in the package info.
2651c55 to
d382736
Compare
| // Extrack package distro and version | ||
| distroName := "" | ||
| distroVersion := uint32(0) | ||
| if strings.HasPrefix(parts[1], azureLinuxPackagePrefix) { |
There was a problem hiding this comment.
The dracut package version check you will need to do for each distro/distro-version combination will likely need to be different. So, it probably isn't worth splitting the distro and distro-version.
For example, have a map of distro+version -> minimum supported dracut version.
There was a problem hiding this comment.
My thinking is that the generic pkg level api, here in customizepackages, is agnostic of how the version information will be used, and hence we should centralize the code to break down and let higher level code decide how to use the data.
For this PR, there is the verifyDracutPXESupport function using this version information. This is where we could implement the map as the need arises. For now, we have only 3.0 to support, and the version check is relatively simple. If in the future we run into a scenario where the pxe version check needs to be different for each major azl release, then we can introduce map.
| } | ||
|
|
||
| type OSSavedConfigs struct { | ||
| DracutPackageInfo DracutPackageInformation `yaml:"dracutPackage"` |
There was a problem hiding this comment.
Within the initramfs file, the /etc/os-release file contains both the distro + version and the dracut version. Our dracut.spec file even patches the package release version into dracut.
For example:
NAME="Microsoft Azure Linux"
ID=azurelinux
VERSION_ID="3.0"
ANSI_COLOR="1;34"
HOME_URL="https://aka.ms/azurelinux"
BUG_REPORT_URL="https://aka.ms/azurelinux"
SUPPORT_URL="https://aka.ms/azurelinux"
VERSION="3.0.20240824 dracut-102-4.azl3"
PRETTY_NAME="Microsoft Azure Linux 3.0 dracut-102-4.azl3 (Initramfs)"
DRACUT_VERSION="102-4.azl3"So, if you extracted that file, we wouldn't need to carry around the dracut version in the save config file.
This would also make the code more distro independent.
There was a problem hiding this comment.
Interesting - just tried it. I will need to unpack the initrd, parse the os-release file, and then clean-up.
The current implementation captures the dracut version by running rpm while we have the rootfs expanded, and then later the information is parsed along with the rest of the saved configs.
The caching allows us to modify an iso image faster than unpacking initrd. The code in mic will not be simpler because of the additional logic (while we already have logic for saving/loading configs - so, minimal cost there).
I think your point about being distro-independent refers to the fact that we won't depend on running rpm - correct? But when we support other distros, we'd probably abstract the package manager and the code will be the same at a higher level.
I'm leaning towards using the cached copy instead of re-extracting it every run.
| // If the specified URL is not a full path to an iso, append the generated | ||
| // iso file name to it. | ||
| if pxeIsoImageFileUrl == "" { | ||
| pxeIsoImageFileUrl, err = url.JoinPath(pxeIsoImageBaseUrl, outputImageBase+".iso") |
There was a problem hiding this comment.
I believe this is only correct because LiveOSIsoBuilder.createIsoImage() / isomakerlib appends .iso to the filename. This makes verifying code correctness difficult. I also don't like the fact that the output filename could be different than the one the user provided if the user doesn't use the .iso extension.
There was a problem hiding this comment.
And a minimum, you should at least have a helper function within this file that handles adding ".iso". Currently, there are 3 separate locations within this file that does this.
There was a problem hiding this comment.
Technically, I agree that we should honor the user specified output image name - though it'd be strange if the user wants an iso image that does not have an iso extension. I think, in practice, this will be very rare.
3a85100 to
230c9f0
Compare
7e82fb3 to
765122b
Compare
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-staticsubpackages, etc.) have had theirReleasetag incremented../cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json)./LICENSES-AND-NOTICES/SPECS/data/licenses.json,./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md,./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)*.signatures.jsonfilessudo make go-tidy-allandsudo make go-test-coveragepassSummary
This change enables the Azures Linux Image Customizer to generate liveos ISO images that are 'PXE-ready'. To be 'PXE-ready', the user should be able to take the generated artifacts, copy them to a PXE server, and is then able to boot PXE clients - without any modifications to any of the artifacts.
To enable such experience, the work involves:
The first requirement is broken in Dracut 102 and earlier versions. The fix is covered by this PR: Enable Dracut's livenet rootfs handling when systemd-networkd is in use..
The other three requirements are implemented in this PR.
The changes include:
Regression Risk
Small.
This is a new code path enabling a new flow. However, there's some overlap with saving MIC internal state between runs.
Change Log
Does this affect the toolchain?
Associated issues
Links to CVEs
Test Methodology
Unit Tests
Functional Tests
--output-pxe-artifacts-dirparameter.--output-pxe-artifacts-dirparameter.