Skip to content

Conversation

@lucab
Copy link
Contributor

@lucab lucab commented Dec 14, 2018

This adds support for building a squashfs rootfs image. It can be
directly run by systemd-nspawn or later assembled into ISO/PXE
artifacts.

@lucab lucab changed the title builtextend: produce a sqaushfs artifact builtextend: produce a squashfs artifact Dec 14, 2018
This adds support for building a squashfs rootfs image. It can be
directly run by `systemd-nspawn` or later assembled into ISO/PXE
artifacts.
@lucab
Copy link
Contributor Author

lucab commented Dec 14, 2018

I didn't test this thoroughly, but @dustymabe was interested in it.

@dustymabe
Copy link
Member

yep. will mark WIP for now. I was interested in the steps and this should allow me to look through. Thanks @lucab

@dustymabe dustymabe changed the title builtextend: produce a squashfs artifact [WIP] builtextend: produce a squashfs artifact Dec 14, 2018
@dustymabe dustymabe added the WIP PR still being worked on label Dec 14, 2018
'-f', 'ext2',
'-o', f"{vmbuilddir}"])

nproc = multiprocessing.cpu_count()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'-drive', f"if=none,id=drive-scsi0-0-0-1,discard=unmap,file={workdir}/cache/cache.qcow2",
'-device', 'scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1',
'-virtfs', f"local,id=workdir,path={workdir},security_model=none,mount_tag=workdir",
'-serial', 'stdio', '-append', 'root=/dev/sda console=ttyS0 selinux=1 enforcing=0 autorelabel=1'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully a next step after this would be to rewrite runcompose()/runvm() to use this instead.

vmpreparedir = f"{workdir}/tmp/supermin.prepare"
if os.path.isdir(vmpreparedir):
shutil.rmtree(vmpreparedir)
os.makedirs(vmpreparedir, exist_ok=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An ensure_empty_dir() in cmdlib.py would make sense.

rpms = []
with open(f"{libdir}/vmdeps.txt") as vmdeps:
for line in vmdeps:
if not line or line.startswith('#'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write if line == "" instead of if not line since I have been bitten in the past trying to remember how different languages coerce to booleans.

script = f'''#!/usr/bin/env bash
set -xeuo pipefail
ostree checkout --repo {workdir}/repo/ {ref} /tmp/rootfs
/sbin/mksquashfs /tmp/rootfs {workdir}/{tmp_img}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a stub right? The commit description says it's bootable this won't do that AFAICS.

This whole concept kind of depends on us reworking to use not-anaconda right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no.

This a basic ostree->squashfs conversion, and the resulting artifact can already be run by systemd-nspawn --volatile --boot (I wouldn't say it's bootable, as it doesn't contain any bootloader). No very interesting per se, but (possibly) an intermediate step towards re-using this rootfs for embeddeding in live PXE/ISO artifacts.

In that regard, this flow is already bypassing anaconda. It consumes an ostree ref and runs this build-extending script in a supermin VM.

@cgwalters
Copy link
Member

(Overall, excellent code!)

@bgilbert
Copy link
Contributor

bgilbert commented Sep 5, 2019

#738 is intended to supersede this.

@lucab
Copy link
Contributor Author

lucab commented Sep 5, 2019

@bgilbert thanks for taking it over.

Should we close this one then? Or is there an interest in publishing rootfs-as-squashfs on its own? (I thought I filed a ticket to track the latter question, but I'm not finding it right now)

@bgilbert
Copy link
Contributor

bgilbert commented Sep 6, 2019

Let's close this, I think. We can always wrap a buildextend command around gf-mksquashfs if desired.

@lucab lucab closed this Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP PR still being worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants