-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove use of sgdisk as sfdisk already supports GPT partitions #5278
Conversation
sfdisk already fully supports GPT partitions. Remove redundant code that uses sgdisk for GPT. Signed-off-by: Ani Sinha <anisinha@redhat.com>
The failed check is also failing for other PRs. |
@ani-sinha Is sgdisk not used anywhere? |
It's much less used these days. We would want to get rid of it as sfdisk is more common. |
Another thing is, I have not actually tested this change beyond the usual initial tests and integration tests. We need to make sure that sfdisk can handle EFI partitions with the same options or if something different needs to be passed. I didn't have much time today but maybe I can test something later next week if needed. |
I'm in agreement that getting rid of unused code is a good thing. My question is whether you are confident that no distro is using it currently. This change would break anybody that's using sgdisk and doesn't have one of the alternate tools available. Also we need to be sure that the version of sfdisk used in all supported distros is capable of GPT partitions. I don't want to break compatibility with, say, a BSD if this capability isn't available everywhere. |
Well currently if MBR is used, we need sfdisk. So the question is, is there any distro that does not support MBR? Unlikely. Besides sfdisk support GPT from 2017 onwards. Its much more widely known IMHO than sgdisk. So it is highly unlikely that anyone would have a version of sfdisk that does not support GPT and we would need sgdisk. Another issue is that downstream distros generally use their package management tools (rpm, apt etc) to make sure that the dependencies are listed correctly so that when cloud-init is installed, all the dependent packages are installed . I am finding it hard to believe that they would not list sfdisk as one of the dependencies for cloud-init. If they did not, its a matter of updating cloud-init docs to make sure that people know we made this change and they need to make updates for the dependent packages in the downstream specific package management scripts. I think without our ability to make changes like this (even sometimes when it comes at the cost of temporarily breaking some cases) we cannot make progress. You guys have argued this in the context of another change (when you introduced a new status code 2). I am making the same argument here. |
This reasoning would make sense if only one sfdisk project existed.
We agree that these breaking changes are needed to make progress. I don't object to breaking compatibility with old unsupported OSes. I'm concerned that the proposed code is not just a temporarily breaking change. That is why I pointed to the BSDs in my earlier response. At a glance, it doesn't look like Freebsd's sfdisk supports GPT partitioning. I think that at least FreeBSD currently still requires sgdisk, and maybe others too (@igalic thoughts?). We can still drop sgdisk from use on Linux, but the change should use the proper abstractions to avoid breaking other OSes. To make this change without breaking the BSDs, one could shift this OS-specific code into the Going forward in this codebase we should consider putting calls to external tools into the abstractions under |
After looking at cgdisk output and sfdisk output and how they are used in cloud-init, it seems the output from the two tools are not compatible. In particular, the ID values for GPT partitions are different - fdisk returns UUID, gdisk returns hex MBR-type values (see https://github.com/Shihta/gdisk/blob/master/parttypes.cc#L70) . The config for GPT uses the MBR type values currently and hence in order to not break existing setups, we need to translate UUID values to MBR type values like in the table in the link. This is more complicated than I thought and has potential to break customers existing setups. So after internal discussions, we decided not to pursue this approach. |
@ani-sinha That sounds reasonable. Thanks for contributing! |
Proposed Commit Message
sfdisk already fully supports GPT partitions. Remove redundant code that uses sgdisk for GPT.
Merge type