Conversation
Signed-off-by: Tai Groot <tai@taigrr.com>
Signed-off-by: Tai Groot <tai@taigrr.com>
Signed-off-by: Tai Groot <tai@taigrr.com>
Signed-off-by: Tai Groot <tai@taigrr.com>
Signed-off-by: Jay Pipes <jaypipes@gmail.com>
|
I think that the original had the same issue and this is, anything checking the len(disk.Partition) to identify the number of partitions will misbehave or get the wrong results once they upgrade to the version with this change. This also means that you cannot diff between a disk without partitions and a disk with a single partition? Anyway, its good to me, but it should be mentioned in the release notes probably if we dont want people updating it and suddenly having a different behavior :D |
@Itxaka ack. Perhaps a better solution would be to have a new, separate field on |
I think that depends a lot on what do you want to show or interpret a disk with no partitions I guess. After all a disk with no partitions should return no partitions, but how do you show if the disk itself does have a filesystem on it? Do we expand the Disk struct to show a mountpoint+filesystem itself and fill that up? That feels more correct, but its a waster of resources as Im sure about 98% of disks out there are partitioned instead of with a fs on top. Does it make sense to create a whole new thing to represent that state or do we take the shortcut to show it as partition zero and call it day + a note int he release notes? No idea to be honest :D |
|
it's certainly an odd situation but it was one i ran into regularly at my old job :) kiosks running embedded / yocto linux often had no partitions on their external media drives probably equally common to have A / B boot partitions as it is to have no partitions at all when you consider legacy media. the reason for my fork was to enable live metric gathering and reporting over our data plane since the default looping patterns didn't work on those machines or their USB updater sticks personally my recommendation would be to err towards semantically correct over efficiency but of course you may disagree. this is go we're talking about, we're not hitting 0 alloc metrics or anything as-is, an extra struct (or even struct pointer if you want) with an omitzero on it probably makes little difference |
|
Im ok any case, Ill check my code to see if I do the len(disk.Partitions) trick to check if the disk is empty before updating the the next ghw version LOL :D |
If a disk has no partitions, common use cases for looping over partitions on the disk array created by Block.New() don't work as expected.
Now, underlying partition functions detect partitionless disks and treat a full-disk filesystem as a partition.
The Partition UUID is set to the empty string (since there isn't one), so this behavior can be detected.
Authored-by: Tai Groot tai@taigrr.com
Closes Issue: #256