-
Notifications
You must be signed in to change notification settings - Fork 542
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
[mic][iso] generate PXE-bootable ISO images. #10595
base: 3.0-dev
Are you sure you want to change the base?
Conversation
f2825b8
to
d6fd3b9
Compare
@@ -0,0 +1,147 @@ | |||
From 2888695d6e1e03f727fe45d6e38fc71f7b5be123 Mon Sep 17 00:00:00 2001 |
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.
This change should probably be split off into a separate PR so that it can reviewed separately from the MIC PXE feature.
@@ -0,0 +1,147 @@ | |||
From 2888695d6e1e03f727fe45d6e38fc71f7b5be123 Mon Sep 17 00:00:00 2001 |
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.
This patch means that the MIC PXE feature will require a minimum version of Azure Linux 3.0 to be able to function. In addition, you will be unlikely to be able to apply this patch to Azure Linux 2.0.
At a minimum, MIC should check for this patch in some way and error out if it isn't available. That will at least avoid the situation where it silently fails for the user.
Though, it might be good to investigate ways we could make MIC PXE feature independent of the Azure Linux version.
|
||
Below is a list of the files necessary for PXE booting: | ||
|
||
``` |
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.
What file format is this? It isn't something I recognize.
Also, you seem to be using both //
and #
for comments.
Would it make sense to use a Markdown table instead?
|
||
Specifies the PXE-specific configuration for the generated OS artifacts. | ||
|
||
<div id="pxe-isoimageurl"></div> |
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.
Don't add div
unless the header is ambiguous. Not all Markdown tools handle div
. So, limiting their use is goodness.
fi | ||
copy_file $artifactsRootDir/boot/grub2/grubenv $tftpLocalDir/boot/grub2/grubenv | ||
|
||
# replace every '/' with a '\/' to avoid breaking sed search/replace syntax. |
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.
sed
can take any character after the s
. It might be goodness to use a character not supported in URLs. e.g. s|<old>|<new>|g
function mount_iso() { | ||
local isoPath=$1 | ||
local mountDir=$2 | ||
sudo rm -rf $mountDir |
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.
Don't use sudo
in scripts. If the script needs root privileges, then the entire script should be run as sudo.
|
||
function show_usage() { | ||
echo | ||
echo "$(basename ${BASH_SOURCE[0]}) <source-path>" |
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.
Doesn't <source-path>
need the -s
prefix?
if err != nil { | ||
return fmt.Errorf("failed to create iso image:\n%w", err) | ||
} | ||
|
||
err = populatePXEArtifactsDir(isoImagePath, b.workingDirs.isoBuildDir, outputPXEArtifactsDir, outputImageBase) |
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.
populatePXEArtifactsDir
is called at the end of both createLiveOSIsoImage
and createImageFromUnchangedOS
. Would it make sense to move the populatePXEArtifactsDir
call to convertWriteableFormatToOutputImage
instead?
} | ||
} | ||
|
||
err = b.updateGrubCfg(b.artifacts.savedKernelArgsFilePath, b.artifacts.grubCfgPath, extraCommandLine) | ||
err = b.updateGrubCfg(b.artifacts.savedConfigsFilePath, b.artifacts.isoGrubCfgPath, extraCommandLine, b.artifacts.pxeGrubCfgPath, pxeIsoImageUrl, outputImageBase) |
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.
Please line wrap at 120.
} | ||
|
||
isoGrubCfg := filepath.Join(outputPXEArtifactsDir, "boot/grub2/grub.cfg") | ||
pxeGrubCfg := filepath.Join(outputPXEArtifactsDir, "boot/grub2/grub-pxe.cfg") |
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.
You should place these 2 file paths in constants.
@@ -810,7 +957,7 @@ func (b *LiveOSIsoBuilder) prepareArtifactsFromFullImage(inputIsoSavedKernelArgs | |||
// | |||
// ouptuts: | |||
// - create a LiveOS ISO. | |||
func (b *LiveOSIsoBuilder) createIsoImage(additionalIsoFiles []safechroot.FileToCopy, isoOutputDir, isoOutputBaseName string) error { | |||
func (b *LiveOSIsoBuilder) createIsoImage(additionalIsoFiles []safechroot.FileToCopy, isoOutputDir, isoOutputBaseName string) (isoRepoDirPath string, err error) { |
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.
Should this be isoImagePath
instead of isoRepoDirPath
?
|
||
<div id="pxe-isoimageurl"></div> | ||
|
||
### isoImageUrl [string] |
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.
It might be better to have 2 mutually exclusive fields: isoImageBaseUrl
(which adds ISO file name) and isoImageFileUrl
(which doesn't add the ISO file name). That way, it avoids the behavior changing based on the format of the URL.
create mode 100644 modules.d/90livenet/liveos-artifacts-download.service | ||
create mode 100755 modules.d/90livenet/liveos-artifacts-download.sh | ||
|
||
diff --git a/modules.d/90livenet/liveos-artifacts-download.service b/modules.d/90livenet/liveos-artifacts-download.service |
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.
this file and another may be more maintainable as additional sources instead of baking them into the patch, since they are entirely new files. you would copy them to the appropriate location before the build.
%prep
%autosetup -p1 -n %{name}-ng-%{version}
cp %{SOURCE1} .
cp %{SOURCEX} modules.d/90livenet/liveos-artifacts-download.service
...
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.
pending
e5ee6be
to
39eea29
Compare
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-static
subpackages, etc.) have had theirRelease
tag 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.json
filessudo make go-tidy-all
andsudo make go-test-coverage
passSummary
This changes updates the Azures Linux Image Customizer to emit iso images that are PXE-ready.
The changes include:
Change Log
Does this affect the toolchain?
NO
Associated issues
Links to CVEs
Test Methodology
--output-pxe-artifacts-dir