libvirt will take care of scaping any XML special character so Kimchi
does not need to do anything related to that.
For example:
[alinefm@alinefm-TP440 kimchi]$ sudo virsh net-dumpxml
'~!@#$%^&*()[]<>'
<network>
<name>~!@#$%^&*()[]<></name>
<uuid>3f7fc0c9-1c82-4f61-8055-62523a8827d3</uuid>
<bridge name='virbr3' stp='on' delay='0'/>
<mac address='52:54:00:77:d2:cd'/>
<ip address='192.168.3.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.3.129' end='192.168.3.254'/>
</dhcp>
</ip>
</network>
This patch also updated the test case to cover this scenario.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
model/networks.py | 2 --
tests/test_model_network.py | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/model/networks.py b/model/networks.py
index 9ae2ea8..333ea6d 100644
--- a/model/networks.py
+++ b/model/networks.py
@@ -23,7 +23,6 @@ import libvirt
import sys
import time
from libvirt import VIR_INTERFACE_XML_INACTIVE
-from xml.sax.saxutils import escape
from wok.exception import InvalidOperation, InvalidParameter
from wok.exception import MissingParameter, NotFoundError, OperationFailed
@@ -107,7 +106,6 @@ class NetworksModel(object):
self._set_network_vepa(params)
# create network XML
- params['name'] = escape(params['name'])
xml = to_network_xml(**params)
try:
diff --git a/tests/test_model_network.py b/tests/test_model_network.py
index 14d7288..89c9f7d 100644
--- a/tests/test_model_network.py
+++ b/tests/test_model_network.py
@@ -149,7 +149,7 @@ class NetworkTests(unittest.TestCase):
def test_network_lifecycle(self):
# Verify all the supported network type
networks = [{'name': u'kīмсhī-пet', 'connection':
'isolated'},
- {'name': u'nat-network', 'connection':
'nat'},
+ {'name': u'<!nat-network>&',
'connection': 'nat'},
{'name': u'subnet-network', 'connection':
'nat',
'subnet': '127.0.100.0/24'}]
--
2.5.5