- disk.commit()
- del disk
- else:
- # create a new partition table
- dev.disk_create(parted.disk_type_get("msdos"))
-
- # get the disk
- disk= parted.PedDisk.open(dev)
-
- # create one big partition on each block device
- part= disk.next_partition()
- while part:
- if part.type == parted.PARTITION_FREESPACE:
- new_part= disk.partition_new(
- parted.PARTITION_PRIMARY,
- parted.file_system_type_get("ext2"),
- part.geom.start,
- part.geom.end )
-
- constraint = disk.constraint_any()
-
- # make it an lvm partition
- new_part.set_flag(lvm_flag,1)
+ # actually add the partition to the disk
+ disk.add_partition(new_part, constraint)