QA: Fix error regarding missing names of disk configs
authorHelga Velroyen <helgav@google.com>
Wed, 17 Apr 2013 18:55:47 +0000 (20:55 +0200)
committerHelga Velroyen <helgav@google.com>
Thu, 18 Apr 2013 18:07:45 +0000 (20:07 +0200)
This fixes an error in case there are no disk names in the QA config
(which was the case till recently). Right now, QA tries to use 'None'
as disk name and that makes instance creation fail.

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

qa/qa_instance.py

index b348fc8..3d1ef8c 100644 (file)
@@ -55,7 +55,10 @@ def _GetGenericAddParameters(inst, disk_template, force_mac=None):
     for idx, disk in enumerate(qa_config.GetDiskOptions()):
       size = disk.get("size")
       name = disk.get("name")
-      params.extend(["--disk", "%s:size=%s,name=%s" % (idx, size, name)])
+      diskparams = "%s:size=%s" % (idx, size)
+      if name:
+        diskparams += ",name=%s" % name
+      params.extend(["--disk", diskparams])
 
   # Set static MAC address if configured
   if force_mac: