[Kimchi-devel] [PATCH 1/5] Create title tag

Ramon Medeiros ramonn at linux.vnet.ibm.com
Tue Apr 28 13:16:38 UTC 2015


Title tag will store name with special characters, while name will store
with ascii convertion, to keep compatibility with libvirt (that does not
accept unicode string on name tag).

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 src/kimchi/vmtemplate.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index ef97d83..972745f 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -290,7 +290,8 @@ class VMTemplate(object):
 
     def to_vm_xml(self, vm_name, vm_uuid, **kwargs):
         params = dict(self.info)
-        params['name'] = vm_name
+        params['name'] = unicode(vm_name.encode('utf-8'), errors='ignore')
+        params['title'] = vm_name
         params['uuid'] = vm_uuid
         params['networks'] = self._get_networks_xml()
         params['input_output'] = self._get_input_output_xml()
@@ -320,6 +321,7 @@ class VMTemplate(object):
         <domain type='%(domain)s'>
           %(qemu-stream-cmdline)s
           <name>%(name)s</name>
+          <title>%(title)s</title>
           <uuid>%(uuid)s</uuid>
           <memory unit='MiB'>%(memory)s</memory>
           <vcpu>%(cpus)s</vcpu>
-- 
2.1.0




More information about the Kimchi-devel mailing list