Currently, the only thing we check is that instance image fits in a root partition. We need a check that all 3 possible partitions (ephemeral, swap and root) fit on a hard drive. Using test in review https://review.openstack.org/#/c/94620 I deducted the following formula: EPHEMERAL + SWAP + ROOT <= TOTAL_SIZE - 2 MiB.
What these 2 MiB account for:
1. Spacing for MBR before the first partition
2. Spacing after the last partition: parted can't have end of the partition after the end of the disk, i.e. `mkpart XX TOTAL_SIZE` won't work. Version of `parted` in Ubuntu Precise is still able to claim the trailing 1 MiB, if it's possible.
This also accounts for GPT, which stores metadata also in the end.
Copying the IRC chat as a reference here, I will to do some small investigation to see if that's still true:
<lucasagomes> dtantsur, afair, we need to fix some misunderstands with nova as well local_gb, which represents the size of the _whole_ disk for ironic
<lucasagomes> for e.g
<lucasagomes> we have properties/
<lucasagomes> but nova uses it as the size of the root_partition, independent of the ephemeral size or swap size
<lucasagomes> so what's passed for us is, size of the whole disk + eph + swap
<dtantsur> O_O
<lucasagomes> I think that is one reason why we don't have a sanity check within ironic
<lucasagomes> dtantsur, yeah, there's something odd around that area
<lucasagomes> is a bit grey area
<lucasagomes> dtantsur, we may want to calculate it on our driver tho