Open syncroswitch opened 2 years ago
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!
Description I ran into an issue with parted_partitions.set_id. it’s using sfdisk to set the id, and checks if the partition type matches the list available in sfdisk -T, which returns ID name pairs like
but sfdisk --change-id only accepts uuid types when using opt ( deprecation note: this should also be --part-type not --change-id on newer versions of sfdisk )
for example:
fails with partition 2: failed to set partition type
but the same "type" via uuid as listed in fdisk will change the id correctly.
since parted_partitions.set_id only allows the ## IDs, we can’t pass a UUID, but the sfdisk call inside fails if given a ## ID.
Setup running on an i4i.4xlarge in AWS with SLES 15 SP4. A free partition is available, in my case a 100GB unformatted primary partition at /dev/nvme0n1p2
Steps to Reproduce the behavior verify partition present
run partition.system_types to see available types
attempt to change the partition type:
failure to set as the underlying sfdisk command does not accept "29" as a valid uuid failure also occurs if using uuid
because it does not match the output of system_types https://github.com/saltstack/salt/blob/master/salt/modules/parted_partition.py#L376 which uses compares the input type id to the output of sfdisk -T https://github.com/saltstack/salt/blob/master/salt/modules/parted_partition.py#L395 but omits the -X label portion to differentiate between mbr and gpt ids.
the call to sfdisk -T needs to be aware if the partition latyout if mbr and gpt and set the '-X label' to match
Expected behavior salt-call --local partition.set_id /dev/DEVICE PARTITION UUID should work on gpt partitions
salt-call --local partition.set_id /dev/DEVICE PARTITION ID should work on MBR partitions
error message should be clear if using UUID on MBR or ID on GPT