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

Ramon Medeiros ramonn at linux.vnet.ibm.com
Thu May 7 17:40:31 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). For for details of this bug:

https://bugzilla.redhat.com/show_bug.cgi?id=1062943

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 e047228..52e3333 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -284,7 +284,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(filter(str.isalnum, vm_name.encode('ascii', 'xmlcharrefreplace')))
+        params['title'] = vm_name
         params['uuid'] = vm_uuid
         params['networks'] = self._get_networks_xml()
         params['input_output'] = self._get_input_output_xml()
@@ -312,6 +313,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