=== hggdh is now known as hggdh-msft [09:21] Do we ever check the kernel version inside cloud-init? I'm trying to grep for an example but can't find it. [09:23] Long story short, on my (already closed) PR[0] I recently found out that the fallocate on XFS bug is hit only on kernels < 4.18 (reference: man 8 swapon). [09:26] So I'd like to introduce a condition ` and util.system_info()['release'] >= '4.18'' to the if statement to cloudinit/config/cc_mounts.py:252 [09:26] Couldn't find any trace of packaging.version.parse for that matter, though. Not sure if cloud-init already does this kind of version comparisons in the code base. [09:27] [0] https://github.com/canonical/cloud-init/pull/70 [10:07] otubo: what would packaging.version.parse contain? do we already produce a system_info()['release']? [10:09] meena: packaging.version.parse contains parsers for standard versions systems, we could do things like version.parser(util.system_info()['release']) > version.parse("4.18") for example [10:09] meena: yes we already have util.system_info()['release'] in place [10:10] otubo: cut it down to only have a max of one `.` and then compare them like floats :P [10:10] I think i did that somewhere in puppet code… and… i'm not proud of it, but not ashamed of it either :P [10:11] :-D if it works, it works [10:23] >>> float(str.join('.', os.uname()[2].split('.')[0:2])) [10:23] 4.15 [10:23] this is ugly, and not safe. [11:27] meena: my dear god [11:35] otubo: i'm sure there's a less worse way to do this [11:54] otubo: https://regex101.com/r/6XkWS3/2 [11:56] rather, /3. no one should have negative versions >_> [11:57] and /4 more performant without those flags. [12:06] now with tests, https://regex101.com/r/6XkWS3/5/tests — that website is wonderful 😅 [12:14] wonder if the sample test I added now shows up for others [12:15] nah, looks like it would have to be forked [13:10] meena: OMG! That's helpful. Thanks! :-) [14:05] hi, question - running "cloud-init clean --log --seed" will that be enough for cloud-init to run again the "modules-final/config-scripts" if i'm cloning from this VM ? [14:06] or do i need to delete "/run/cloud-init/" dir too to erase any state which might make cloud-init think is not a "first time boot" ? [14:10] DanyC: i'd think that's what `clean` does. though i don't know what --seed does [14:12] meena: thanks [15:22] otubo: So a danger with matching on kernel versions is that "4.18" on one distro can be very different to "4.18" on others. However, in this case, I think the two cases we need to worry about are: (a) a version older than 4.18 which has support/fixes backported, and (b) a version that claims to be (at least) 4.18 but doesn't have the support/fixes. I feel like we can safely dismiss (b), because that [15:22] seems likely to be a kernel bug/regression. For (a), I think the worst case is that we use dd when we could have used fallocate, which isn't a very bad case at all. === cpaelzer__ is now known as cpaelzer [15:30] meena: I don't think you can compare kernel versions as floats, because kernel version 4.18 > kernel version 4.4 but 4.18 < 4.4. [15:32] Odd_Bloke: wat [15:32] Odd_Bloke: aah, shite. [15:32] :) [15:32] the cheaty way is to break major minor into ints [15:32] Yeah, (4, 18) > (4, 4). [15:32] * rharper may have cheated a few times [15:33] yeah, that way you can compare all dots? (4, 18, 1) [15:33] whooaaaah. [15:34] rharper: that's so cool [15:34] It's barely even cheating, that's why `sys.version_info` is a tuple, so you can do things like `sys.version_info > (3, 3)` for Python version checks. [15:34] TIL [15:34] wonder if that works in ruby, too [15:35] cuz i'm having to teach a developer here what Semver is… [15:35] or, all developers.? [15:35] It's probably sufficient for kernel major/minor/patch, but it falls over if your versioning has prereleases or postreleases (like apt packages do). [15:35] it just gets strange with extra parts, 4.15.0-72-generic [15:35] rharper: LA LA LA LAAAAA [15:36] I don't know what you're talking about meena, we just happen to rev major versions on January 1st every year. ;) [15:36] =) [15:36] Odd_Bloke: that's 💯 % valid [15:41] http://sentimentalversioning.org/ [15:46] I can only aspire to have an idea as good as using pi for version numbers.