This patch fixes the disk size requirements computation in the 'ComputeDiskSizePerVG' method.
Currently, this method does not sum up the size requirements of all the disks of an instance that reside in the same volume group, as intended. Instead, it returns the size requirement of only the last disk of the instance due to a wrong key application to the 'vgs' dictionary. This patch fixes this issue. Signed-off-by: Dimitris Bliablias <[email protected]> --- lib/cmdlib/instance_storage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cmdlib/instance_storage.py b/lib/cmdlib/instance_storage.py index 91670da..0e3c28e 100644 --- a/lib/cmdlib/instance_storage.py +++ b/lib/cmdlib/instance_storage.py @@ -293,8 +293,9 @@ def ComputeDiskSizePerVG(disk_template, disks): """ vgs = {} for disk in disks: - vgs[disk[constants.IDISK_VG]] = \ - vgs.get(constants.IDISK_VG, 0) + disk[constants.IDISK_SIZE] + payload + vg_name = disk[constants.IDISK_VG] + vgs[vg_name] = \ + vgs.get(vg_name, 0) + disk[constants.IDISK_SIZE] + payload return vgs -- 1.7.10.4
