From 0a6301aed2f4bc0d31b61a9882c31cce48d642aa Mon Sep 17 00:00:00 2001
From: Helga Velroyen <helgav@google.com>
Date: Wed, 17 Apr 2013 20:55:47 +0200
Subject: [PATCH] QA: Fix error regarding missing names of disk configs

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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index b348fc845..3d1ef8c69 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -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:
-- 
GitLab