-
Notifications
You must be signed in to change notification settings - Fork 93
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
osmet: efficient packing/unpacking of CoreOS metal images #187
Conversation
This is also missing scanning the |
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs.
See the cosa side of this at coreos/coreos-assembler#1244. That's one way of running this. Though you can also run the
Or you can just bring up a VM with the metal image attached:
And play with the |
I haven't addressed @lucab's review comments yet, but I fixed up all the |
Just noting here to remember for myself: in a conversation with @lucab, he mentioned it'd be useful to have a |
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs.
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.
OK so I only gave this the start of a review then ran out of bandwidth.
Overall...I trust you, and the code looks really great. I would be fine landing this and trying it out at least.
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs.
OK, marking this as ready for review! I've had to rework unpacking to make it happen in a thread so that we can just reuse the same The second commit here is a key change: we teach |
Some follow-ups to this:
|
Hmm actually, I think we'll need to switch to it as the default as a separate step to help ratchet this in. So the order would be:
|
OK, dropped that commit! |
CI fix in #198. |
How is it different than jigdo? |
It's a more targeted and efficient solution for what we need to start. See also rojig BTW which is inspired by jigdo, but (a lot like osmet) is optimized around OSTree and not debs/rpms. |
Can you confirm that we're not truly committing to any kind of ABI around osmet? In the end we will ship a And another question - we're still verifying the checksum of the resulting image, right? So at worst, osmet could fail to work, but would not write a corrupted image. |
Yes, the osmet file isn't and shouldn't for the time being be a distinct public artifact. Importantly, we can assume a strong binding between the packing and unpacking paths (which as you mentioned is why coreos/coreos-assembler#1244 usies the coreos-installer binary from the tree itself). The versioning in the file format is more as a good practice than anything. Concretely then, this means that we are free to change the implementation details of how offline installs work. Essentially the only API that we're making public with this is that there is an offline path that uses just the live ISO as the artifact.
Correct. More precisely, the following checks are in place:
|
One thing I can probably help with is adding |
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs.
I was hoping for @bgilbert to have another look at this before merging since he did such an awesome review. But I think he's been away this week. I do think it's in a pretty good shape though and that we can fixup things as follow-ups. Maybe let's give it until Monday?
Thanks, that'd be awesome! Actually, with this PR, we could have a test already that uses And thinking more on this... since it's way more work to respin coreos-installer than cosa, maybe what we should do is land coreos/coreos-assembler#1244 first, but with the osmet packing step behind a switch to |
One thing I wanted to note here is that I tested osmet in earnest on RHCOS yesterday (previously, I had only sanity-checked that And we can make it work, but the LUKS container complicates things. So the code here will need to be adapted to handle that (essentially adding to the mapping offsets the offset of the LUKS data). IOW, this will not work yet as is on RHCOS. |
Ug. It probably wouldn't be seriously hard to rework the rhcos luks bits to just leave a bit of space for the luks header before the root partition, and when LUKS is enabled, just move the partition back and generate the header only when it's required, that would allow us to drop all the LUKS bits from almost everywhere. Including the dm-linear bit. |
That'd definitely make things simpler. Not that it's hard to handle it, but it feels awkward to do. From my experimentation yesterday, we have to Is the amount of work required to do the header fiddling work (and all the simplifications that ensue) justified given that (IIUC) the end goal is to get rid of it entirely in favor of coreos/fedora-coreos-tracker#94? |
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs.
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs. One thing to note is that the metal image is now always required before building the live ISO. This is because the whole point of osmet is to efficiently pack the metal image. Since osmet obsoletes the `fulliso` artifact, this PR also removes support for it.
Let's hold this until tomorrow morning. @bgilbert told me he should be able to take another look then. (And actually, I still want to get the cosa bits in so we can test it in CI here.) |
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs. One thing to note is that the metal image is now always required before building the live ISO. This is because the whole point of osmet is to efficiently pack the metal image. Since osmet obsoletes the `fulliso` artifact, this PR also removes support for it.
This is the server side required for osmet packing: coreos/coreos-installer#187 We run `osmet pack` when creating the live ISO and include the osmet binary as part of the CPIO containing the root squashfs. One thing to note is that the metal image is now always required before building the live ISO. This is because the whole point of osmet is to efficiently pack the metal image. Since osmet obsoletes the `fulliso` artifact, this PR also removes support for it.
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.
LGTM generally. Some nits, but I'm okay deferring those to a followup.
OK, addressed comments and added a second commit here which turns on CI testing via osmet! Feel free to do another final review on the latest minor changes, though otherwise will merge on green! |
Introduce a new `osmet` command with two primary subcommands: `pack` and `unpack`. Together, these allow offline bare metal installation of CoreOS images while only slightly increasing the size of the initramfs. The `pack` subcommand takes as input a block device of a CoreOS metal image and the expected checksum to match. It mounts the root partition from that device and generates a smaller version of the metal image itself with the OSTree objects "punched out" (this is called the "punched image" in the code). The command outputs this smaller version as well as a lookup table of where the OSTree objects belonged into an "osmet" binary file. The `unpack` subcommand takes as input an osmet binary file and a path to an OSTree repo and reconstrust the metal image, bit for bit. This command is more for testing in practice. The following patch will teach the `install` command to use the osmet path by default, which is how users will interact with this.
This turns on CI testing for the offline path (via osmet). In the future, we will drop `--osmet` entirely since it'll always be on. (And similarly, the `iso-offline-install` might become the same thing as `iso-install` so we might be able to drop it entirely.) See coreos/coreos-assembler#1244.
🎉 |
Yay. this works! My cosa run made a metal image that looks like:
I booted to the Live ISO and run the installer in offline mode!
And then I read back the written out contents and it matches the same
Nice work @jlebon! |
One thing that might be concerning from an "optics" point of view from the end user perspective is that the installer now reports a much larger number than it did in the past because it's dealing with uncompressed data rather than real data.. Using
using
I know the resulting written image to disk is the same size but it does make us look like we're bigger than we were even though we've actually been this size the whole time. |
Introduce a new
osmet
command with two primary subcommands:pack
andunpack
. Together, these allow offline bare metal installation ofCoreOS images while only slightly increasing the size of the initramfs.
The
pack
subcommand takes as input a block device of a CoreOS metalimage and the expected checksum to match. It mounts the root partition
from that device and generates a smaller version of the metal image
itself with the OSTree objects "punched out" (this is called the
"punched image" in the code). The command outputs this smaller version
as well as a lookup table of where the OSTree objects belonged into an
"osmet" binary file.
The
unpack
subcommand takes as input an osmet binary file and a pathto an OSTree repo and reconstrust the metal image, bit for bit. This
command is more for testing in practice. The following patch will teach
the
install
command to use the osmet path by default, which is howusers will interact with this.