Skip to content

Commit 77a4590

Browse files
authored
Merge pull request #43 from ndechesne/lun-physical-part
gen_partition: skip physical_partition with no partition
2 parents 8b27920 + 72f855b commit 77a4590

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gen_partition.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,18 @@ def generate_ufs_xml (disk_params, partition_entries_dict, output_xml):
188188
)
189189
lun_index=0
190190
while lun_index < 6:
191-
phy_part = ET.SubElement(root, "physical_partition")
191+
found = False
192192

193193
for partition_index, entry in partition_entries_dict.items():
194194
part_entry = parse_partition_entry(entry)
195195
if part_entry["physical_partition"] == str(lun_index):
196196
del part_entry["physical_partition"]
197+
# if there is no partition in the LUN, skip the physical_partition in XML
198+
# only create the physical_partition once we have at least one partition
199+
if not found:
200+
phy_part = ET.SubElement(root, "physical_partition")
197201
part = ET.SubElement(phy_part, "partition", attrib=part_entry)
202+
found = True
198203
lun_index +=1
199204

200205
xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml()

0 commit comments

Comments
 (0)