The disk size of a diskless instance is 0, not None
authorKlaus Aehlig <aehlig@google.com>
Mon, 8 Apr 2013 14:35:09 +0000 (16:35 +0200)
committerHelga Velroyen <helgav@google.com>
Wed, 10 Apr 2013 11:53:01 +0000 (13:53 +0200)
For diskless instances it is still reasonable to sum up the disk usage
of all the (zero) disks, resulting in the empty sum. This uniformity
also has the advantage that iallocators (like hail) do not have to do
any special considerations for diskless instances.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/masterd/instance.py

index d99f4d8..0954011 100644 (file)
@@ -1621,7 +1621,7 @@ def ComputeDiskSize(disk_template, disks):
   """
   # Required free disk space as a function of disk and swap space
   req_size_dict = {
-    constants.DT_DISKLESS: None,
+    constants.DT_DISKLESS: 0,
     constants.DT_PLAIN: sum(d[constants.IDISK_SIZE] for d in disks),
     # 128 MB are added for drbd metadata for each disk
     constants.DT_DRBD8: