I have currently some patches coming up for storage pools and volumes based on physical disks. However I have an issue that I would like to hear your opinion about.
When it comes to storage pools and volumes based on physical disks, the name given does not really have any real meaning, the underlying disk/partition will at the end decide the name of the pool/volume (as soon as a refresh on the pool is made, the user defined names will be gone). This is quite confusion but at the end it still works. But there are cases where it does not work.
To be able to create a partition type such as LVM or raid, parted (which is used as the disk management backend) does not support setting this partition type when creating the partition but instead by setting a flag on the partition after it has been created. As it is not possible to decide at which position in the partition table the new partition should be created, parted will just choose the next available number. To be able to set this flag on the partition, we need to know which partition we just created, and suddenly the name of the volume is important, but only if it has followed the rules that parted applied when finding the next available slot. If the name of the volume is incorrect we will end up with a volume created with incorrect type since we can't do 2 operation towards parted in a transaction manner (e.g. Volume name is sdb2 but the newly created partition is sdb1).
I see two possible solutions on this problem:
1. We add volume name constraints in this case that makes sure that when a volume is created by a user (by checking the pool and scan all ready existing volumes in that pool), it has to create a name that is correct according to parted's rules. In that case we can use the volume name to find the partition just created and we can set the flag on the partition in a safe way
2. we extend the libvirt_parthelper and uses the libparted instead to create a partition, which then can be made in a more transaction like manner. However, in this case we have to more or less add all the support that parted has for creating a partition which is quite extensive.
I put my vote on solution 1 but I like to know your opinion and also if any one knows that the initial plans were.