From 9e946416b10e4a070fbd07313df57e88a929f23c Mon Sep 17 00:00:00 2001
From: Klaus Aehlig <aehlig@google.com>
Date: Mon, 8 Apr 2013 16:35:09 +0200
Subject: [PATCH] The disk size of a diskless instance is 0, not None

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/masterd/instance.py b/lib/masterd/instance.py
index d99f4d87b..095401121 100644
--- a/lib/masterd/instance.py
+++ b/lib/masterd/instance.py
@@ -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:
-- 
GitLab