=== hggdh is now known as hggdh-msft | ||
otubo | Do we ever check the kernel version inside cloud-init? I'm trying to grep for an example but can't find it. | 09:21 |
---|---|---|
otubo | 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:23 |
otubo | 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 |
otubo | 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:26 |
otubo | [0] https://github.com/canonical/cloud-init/pull/70 | 09:27 |
meena | otubo: what would packaging.version.parse contain? do we already produce a system_info()['release']? | 10:07 |
otubo | 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 |
otubo | meena: yes we already have util.system_info()['release'] in place | 10:09 |
meena | otubo: cut it down to only have a max of one `.` and then compare them like floats :P | 10:10 |
meena | I think i did that somewhere in puppet code… and… i'm not proud of it, but not ashamed of it either :P | 10:10 |
otubo | :-D if it works, it works | 10:11 |
meena | >>> float(str.join('.', os.uname()[2].split('.')[0:2])) | 10:23 |
meena | 4.15 | 10:23 |
meena | this is ugly, and not safe. | 10:23 |
otubo | meena: my dear god | 11:27 |
meena | otubo: i'm sure there's a less worse way to do this | 11:35 |
meena | otubo: https://regex101.com/r/6XkWS3/2 | 11:54 |
meena | rather, /3. no one should have negative versions >_> | 11:56 |
meena | and /4 more performant without those flags. | 11:57 |
meena | now with tests, https://regex101.com/r/6XkWS3/5/tests — that website is wonderful 😅 | 12:06 |
ananke | wonder if the sample test I added now shows up for others | 12:14 |
ananke | nah, looks like it would have to be forked | 12:15 |
otubo | meena: OMG! That's helpful. Thanks! :-) | 13:10 |
DanyC | 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:05 |
DanyC | 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:06 |
meena | DanyC: i'd think that's what `clean` does. though i don't know what --seed does | 14:10 |
DanyC | meena: thanks | 14:12 |
Odd_Bloke | 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 |
Odd_Bloke | 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. | 15:22 |
=== cpaelzer__ is now known as cpaelzer | ||
Odd_Bloke | 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:30 |
meena | Odd_Bloke: wat | 15:32 |
meena | Odd_Bloke: aah, shite. | 15:32 |
Odd_Bloke | :) | 15:32 |
rharper | the cheaty way is to break major minor into ints | 15:32 |
Odd_Bloke | Yeah, (4, 18) > (4, 4). | 15:32 |
* rharper may have cheated a few times | 15:32 | |
meena | yeah, that way you can compare all dots? (4, 18, 1) | 15:33 |
meena | whooaaaah. | 15:33 |
meena | rharper: that's so cool | 15:34 |
Odd_Bloke | 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 |
meena | TIL | 15:34 |
meena | wonder if that works in ruby, too | 15:34 |
meena | cuz i'm having to teach a developer here what Semver is… | 15:35 |
meena | or, all developers.? | 15:35 |
Odd_Bloke | 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 |
rharper | it just gets strange with extra parts, 4.15.0-72-generic | 15:35 |
meena | rharper: LA LA LA LAAAAA | 15:35 |
Odd_Bloke | I don't know what you're talking about meena, we just happen to rev major versions on January 1st every year. ;) | 15:36 |
rharper | =) | 15:36 |
meena | Odd_Bloke: that's 💯 % valid | 15:36 |
meena | http://sentimentalversioning.org/ | 15:41 |
Odd_Bloke | I can only aspire to have an idea as good as using pi for version numbers. | 15:46 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!