[Kimchi-devel] [PATCH] Force qcow2 when creating a VM based on backing image

Jose Ricardo Ziviani joserz at linux.vnet.ibm.com
Wed Jul 29 16:04:37 UTC 2015


 - When using a backing image as template the target must be a qcow2
   image.

Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
 src/kimchi/vmtemplate.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 2646573..a165a5d 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -232,12 +232,18 @@ class VMTemplate(object):
             v_tree = E.volume(E.name(info['name']))
             v_tree.append(E.allocation(str(info['allocation']), unit='G'))
             v_tree.append(E.capacity(str(info['capacity']), unit='G'))
-            target = E.target(
-                E.format(type=info['format']), E.path(info['path']))
+
+            target_fmt = info['format']
             if 'base' in d:
+                # target must be qcow2 in order to use a backing file
+                target_fmt = 'qcow2'
+
                 v_tree.append(E.backingStore(
                     E.path(info['base']['path']),
                     E.format(type=info['base']['format'])))
+
+            target = E.target(
+                E.format(type=target_fmt), E.path(info['path']))
             v_tree.append(target)
             info['xml'] = etree.tostring(v_tree)
             ret.append(info)
-- 
1.9.1




More information about the Kimchi-devel mailing list