/srv/irclogs.ubuntu.com/2024/04/11/#cloud-init.txt

meenaholman: have you got any machines with ZFS where you're testing this growpart stuff on?14:59
meenaI'm currently baffled by my log output, and might need to add some more logs, because, well, it's just baffling nothingness15:00
meenaso, right now, for ZFS, this code is failing here: https://github.com/canonical/cloud-init/blob/main/cloudinit/config/cc_growpart.py#L436-L458 (i marked both conditionals, because if it were to continue, it would fail the next condition, too)15:10
meenai love that we call         result = util.get_mount_info(devent) and then discard the filesystem info15:13
minimalmeena: yeah the growpart code in general is "funky", when I've worked on it in the past I ended up putting extra debug statements throughout the code to see what was happening15:20
minimalwhat exactly is the failure? that the ZFS device is not a block device?15:20
meenaminimal: exactly15:24
meenait's just some weird string that means nothing to the os, so os.stat will do nothing15:24
meenawe handle it correctly in get_size() but not that function15:24
minimalmeena: I'm not familiar with ZFS but in general for Unix/Linux/etc I thought a storage device (containing partitions) was always a block device...15:30
meenaminimal: not with ZFS;15:56
minimalI'm thinking of "classic" Unix...15:57
meenaZFS does the LVM layer and the FS layer, in Linux, or, AIX terms… and as such it's a bit opaque15:57
holmanuh-oh - hmm15:59
meenaso, i have an incredibly ugly patch that I'm not happy with15:59
holmanI thought we had integration test coverage16:00
meenaI'd like to fix get_size() to work with ZFS16:00
minimalI assume ZFS on Linux behaves in the same fashion16:00
meenai don't want to know how ZFS on Linux behaves.16:00
holmaniirc there's a compat layer to make zfs work on linux16:00
meenaI would like to remain ignorant of ZFS on Linux for at least another week or five16:00
minimalI mean whether on Linux a ZFS device is a block device or not16:01
holmanoh, no I think it's the same on linux in that way16:01
holmanyou get a pool of disk and add the disk to the pool16:01
meenathis is the make it work patch: https://gist.github.com/igalic/b39206b322336f4de4365c342e1f6bc7 I'll work on make it pretty soon16:02
meenawhat if you have more than one disk in a pool?16:02
holmanthat works16:03
minimalI'm "happily oblivious" to ZFS in general :-)16:04
holmanI've "happily not touched" ZFS in about 3 years16:05
holmanand the last time I looked at it its performance on nvme left much to be desired16:06
meenathe thing i like about ZFS is that I haven't lost any data to it, in about… ever.16:06
holmanthere are definitely pros to ZFS :-)16:07
minimalthat reminds me, I need to find time to fight with cc_growpart testcases for some changes I've made locally :-( I find making code changes are easy, adapting existing testcases or adding new testcase is the real struggle16:07
holmanthe growpart code is monstrous for unit tests16:08
holmanit should be broken into more composable units and the tests adapted to test those units16:09
meenaI'm could add a new fs paramter to resize() and then pass that to get_size() so that i can treat ZFS specially, or just assume if get_size() gets something that doesn't start with /dev that it might be ZFS?16:12
minimalholman: it's more due to my limited python skills rather than being specific to the growpart testcases16:16
holmanminimal: nah, the growpart unittests are just bad ;-)16:16
minimalI have changes to support LUKSv1 resizing without needing key but as the changes introduce some new subp's I first need to fix the existing tests (for LUKSv2) accordingly before I can then add similar tests for LUKSv116:18
holmanmeena: sounds reasonable?16:18
minimalanyway I'll have another crack at it later today16:18
holmanmeena: I don't know of any cloud images that are using zfs on root, and I believe the ubuntu installer stuff has its own disk/filesystem code, so you might be the first to exercise this codepath? I don't know the history of this code16:19
holmanmeena: we have one meager integration test that tests growpart (added a couple of years ago) https://github.com/canonical/cloud-init/blob/main/tests/integration_tests/modules/test_growpart.py16:20
holmanmeena: that could probably be extended for zfs pretty easily16:20
meenaI'm not on Linux with ZFS on root, just on regular old FreeBSD with ZFS on Root, of which there are plenty of cloud images16:21
holmanmeena: ohhhh, right16:21
* holman facepalm16:22
meenaI'm the FreeBSD dev, remember?16:22
meenaEither way, I'm just confused how this ever worked before…16:23
holmanhehe16:23
holmanoh yeah me too16:23
holmanthat get_size() stuff might have been a late addition for the logs which just unintentionally broke zfs, I'd have to dig into the history16:24
* holman hopes git blame doesn't point back at himself16:25
meenaeither way, i have to figure out a cool way to find zfs size now16:25
holmanmeena: that lxd integration test^ creates a local sparse file, adds it to the vm as a disk, and then it uses bootcmd to create a tiny partition prior to letting growpart increase the size16:25
meenawow, that… sounds … horrific.16:26
holmanmeena: writing it certainly was :)16:31
meenazpool get -H -o value size zroot                                                              16:3116:31
meena17.5G16:31
meenaso… that's not the value we want16:31
meenawe want, whatever the heck lseek() retruns16:32
meenaor?16:32
holmanbut that integration test allows us to exercise the code in CI 16:33
holmanmeena: question about growpart on zfs16:34
holmanI've only ever created zfs filesystems on full disks16:35
holmannever a partition16:35
holmancan you actually do that with zfs?16:36
meenawe have mkfs.zfs in FreeBSD which you can use to commit horrendous crimes 16:38
meenamostly used in image building, i think16:38
meenaspeaking of crimes: https://gist.github.com/igalic/8dec389052e4113db039036e160a65d016:39
meenaI think the problem is None == None ;)16:48
meenaOptional[int] could return NaN :P16:49
meenazpool get -p -H -o value size zroot19:13
meenagets an integer19:13
minimalholman: you must be able to use ZFS on a partition, otherwise how else would you use ZFS on a bootable UEFI system (where it needs to have a ESP partition/FAT filesystem)?19:18
holmanminimal: ESP doesn't _have_ to be FAT, grub supports ZFS ;)19:44
holmanit's just safer to use FAT because it's no longer changing19:45
minimalholman: the UEFI spec only defines FAT for ESP though...19:45
holmanalso that, yes19:45
minimalactually how would Grub be loaded from ESP by UEFI if the ESP filesystem isn't FAT? ;-)19:46
holmanminimal: grub is written to the disk (before the filesystem starts), grub's config is written to ESP, no?19:47
holmanbeen a while since I've read up on it19:47
minimalsounds like you're thinking of Grub in the boot sector, that is for BIOS, not UEFI booting19:48
holmanahhh, yes probably19:49
minimalfor UEFI the "firmware" either uses a UEFI boot variable (stored on machine's NVRAM) which points to a file in an ESP partition (which has to be FAT fs) or else it fallback to looking for "BOOT/BOORX64.EFI" in the ESP filesystem(s)19:50
minimalGrub is stored as a file in one of more of the directories on the ESP partition/FAT filesystem19:50
holmanI guess I need to update my priors :-)19:51
minimalI'm very familiar with various booting scenarios ;-)19:52
minimalso for a single disk Linux machine to boot UEFI with a ZFS rootfs you'd need to GPT partition the disk with a small ESP (FAT) partition and then another partition using the rest of the disk for ZFS19:53
minimalregardless of whether you're using Grub, or direct Linux kernel UEFI booting, or Limine, or systemd-boot, or some other UEFI-based bootloader19:54
minimalmeena: several days ago you asked about "make cloud-init uninstall itself", I dug up the method I've used in the past (for NoCloud on bare metal), I add this init.d script to the OS disk image and enable it: https://gist.github.com/dermotbradley/0db72a3d3bde41c60c5f3a9930dda6a119:56
meenaminimal: wanna see mine?19:57
minimalsure19:57
holmanthat's related to what I was get at - if you hand zfs a partition, shouldn't you be able to resize that partition and than increase its size in the zfs pool?19:58
meenaminimal: https://codeberg.org/meena/test-cloud-init/src/branch/tofu/aws/ami-user-data.yml 19:58
meenaI'm using the FreeBSD official cloud-init images (why isn't that default??! hopefull it will be, but right now they're buggy … or, inconsistent) to install my own cloud-init19:59
meenathat was a long parenthetical.19:59
holmanwhich makes me wonder if the value we're getting from devent2dev is incorrect20:00
holmanmeena: have you ran freebsd on azure before?20:01
meenaholman: only briefly; It'll be my next test target20:01
meenaAlso because of hvsock20:02
minimalholman: sorry, I thought you'd earlier said something about ZFS only working on a "whole disk", i.e. unpartitioned, and that's why I mentioned needing to partition in order to create ESP for UEFI. I can't seem to find what you wrote earlier that gave me that impression lol20:07
holmanminimal: all good, I'm just trying to undstand the semantics of zfs and partition resize within the context of cloud-init's growpart20:08
holmanand wasn't very clear with what I asked20:09
minimalseems like increase the actual partition, the "zpool online -e", then export pool, then import pool - though not sure if that works with a mounted rootfs20:13
minimalthat's just a (possibly wrong) guess from a brief online search20:15
meenahttps://github.com/freebsd/freebsd-src/pull/116320:23
-ubottu:#cloud-init- Pull 1163 in freebsd/freebsd-src "ec2: homedir bug fixed in cloud-init 24.1.4" [Open]20:23
meenaokay,slightly less unhappy with the state of this (now untested code)23:24

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!