[Kimchi-devel] [PATCH] Nit: refactor vm xml format

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Aug 12 09:20:00 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Move qemu namespace from xml top level to cdrom generation,
so that future cdrom update can just modify this part without
affect top level xml.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/vmtemplate.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 761bac5..c2101db 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -150,7 +150,7 @@ class VMTemplate(object):
         """
 
         qemu_stream_cmdline = """
-            <qemu:commandline>
+            <qemu:commandline %(ns)s>
               <qemu:arg value='-drive'/>
               <qemu:arg value='file=%(url)s,if=none,id=drive-%(bus)s0-1-0,\
 readonly=on,format=raw'/>
@@ -179,7 +179,7 @@ drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/>
             url = protocol + "://" + hostname + ":" + str(port) + url_path
 
         if protocol not in libvirt_stream_protocols:
-            return qemu_stream_cmdline % {'url': url, 'bus': bus}
+            return qemu_stream_cmdline % {'url': url, 'bus': bus, 'ns': QEMU_NAMESPACE}
 
         params = {'protocol': protocol, 'url_path': url_path,
                   'hostname': hostname, 'port': port, 'dev': dev, 'bus': bus}
@@ -365,7 +365,6 @@ drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/>
         params['uuid'] = vm_uuid
         params['networks'] = self._get_networks_xml()
         params['input_output'] = self._get_input_output_xml()
-        params['qemu-namespace'] = ''
         params['cdroms'] = ''
         params['qemu-stream-cmdline'] = ''
         graphics = kwargs.get('graphics')
@@ -389,13 +388,12 @@ drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/>
         if not urlparse.urlparse(self.info.get('cdrom', "")).scheme in \
                 libvirt_stream_protocols and \
                 params.get('iso_stream', False):
-            params['qemu-namespace'] = QEMU_NAMESPACE
             params['qemu-stream-cmdline'] = cdrom_xml
         else:
             params['cdroms'] = cdrom_xml
 
         xml = """
-        <domain type='%(domain)s' %(qemu-namespace)s>
+        <domain type='%(domain)s'>
           %(qemu-stream-cmdline)s
           <name>%(name)s</name>
           <uuid>%(uuid)s</uuid>
-- 
1.8.3.2




More information about the Kimchi-devel mailing list