mirror of
https://github.com/rocky-linux/createhdds.git
synced 2024-11-15 17:51:25 +00:00
Add support for setting the GUID of the partition to set
its correct type. Previously, it was not possible to set the type of the partition via the specific GUID. This commit adds support for adding the GUID into the gtp_type of the partition description in hdds.json and this field will be utilized in to code.
This commit is contained in:
parent
a01d22f6ef
commit
e63e8314f4
@ -147,9 +147,15 @@ class GuestfsImage(object):
|
|||||||
# start and end sector numbers - more details in
|
# start and end sector numbers - more details in
|
||||||
# guestfs docs
|
# guestfs docs
|
||||||
gfs.part_add(disk, part['type'], int(part['start']), int(part['end']))
|
gfs.part_add(disk, part['type'], int(part['start']), int(part['end']))
|
||||||
# identify the partition and format it
|
# identify the partition
|
||||||
partn = gfs.list_partitions()[-1]
|
partname = gfs.list_partitions()[-1]
|
||||||
gfs.mkfs(part['filesystem'], partn, label=part.get('label'))
|
partnum = gfs.part_list(disk)[-1]["part_num"]
|
||||||
|
# sometimes, we want to set the gpt type of the partition
|
||||||
|
gpt_type = part.get("gpt_type", None)
|
||||||
|
if gpt_type:
|
||||||
|
gfs.part_set_gpt_type(disk, partnum, gpt_type)
|
||||||
|
# format the partition
|
||||||
|
gfs.mkfs(part['filesystem'], partname, label=part.get('label'))
|
||||||
# do file 'writes' (create a file with a given string as
|
# do file 'writes' (create a file with a given string as
|
||||||
# its content)
|
# its content)
|
||||||
for write in self.writes:
|
for write in self.writes:
|
||||||
|
Loading…
Reference in New Issue
Block a user