partitionedfs: add disks while adding partitions
The PartitionedMount class used to work as follows:
1. The user adds all partitions using 'add_partition()'. We create an internal
list of partitions.
2. User adds all disks using 'add_disks()'. We create an internal list of
disks. Additionally, 'add_disks()' provides the real disk object.
The problem with this is that in order to create the real disk object, we need
to know its size. But it is difficult to calculate it when complex options like
--align are used.
The real calculations happen in the '__format_disks()' method of
PartitionedMount.
What I want to do is to make things work this way:
1. The user adds all the partitions.
2. The user asks what disk size is required.
3. The user creates disk objects of the right size and adds them.
In order to achieve it, I need to separate out the partitions positioning from
the '_format_disks()' function, and do this before the user adds the disks.
However, the positioning code assumes we already have the internal disks
dictionaries (self.disks). But current code creates those dictionaries only in
'add_disks()', which is too late for our purposes.
This patch basically makes the inderal disks dictionaries while adding the
partitions, because the partition already contains the disk name (internal
target physical name). So we can create the disk dictionaries right away.
The only missing thing will be the host disk objects, which are added by
'add_disks()' later on.
Change-Id: Ie8245c8b61c941165aea3a583826a2896f4c85d9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>