Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com>

I am wondering if it does not apply to all resources: vms, networks and so.

We also need to scape the strings we put in the xml.
Otherwise we will have problems while creating resources.

>>> import cgi
>>> cgi.escape("< & >")
'&lt; &amp; &gt;'


On 02/23/2014 11:58 PM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>

Libvirt only does not allow "/" in storagepool name.
For it will create a storagepool xml by this name.

For example, if we create a name with "pool/name"

Libvirt will try to create the follow storagepool configure file:
/etc/libvirt/storage/pool/name.xml

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
---
 po/en_US.po                              | 4 +---
 po/kimchi.pot                            | 4 +---
 po/pt_BR.po                              | 4 +---
 po/zh_CN.po                              | 6 ++----
 ui/js/src/kimchi.storagepool_add_main.js | 2 +-
 ui/pages/i18n.html.tmpl                  | 2 +-
 6 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/po/en_US.po b/po/en_US.po
index 8ac59c7..36971b6 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -281,9 +281,7 @@ msgstr ""
 msgid "NFS server mount path can not be blank."
 msgstr "NFS server mount path can not be blank."
 
-msgid ""
-"Invalid storage pool name. It may only contain letters, numbers, "
-"underscores, and hyphens."
+msgid "Invalid storage pool name. It should not contain '/'."
 msgstr ""
 
 msgid "Invalid NFS mount path."
diff --git a/po/kimchi.pot b/po/kimchi.pot
index f7b33ee..167911c 100755
--- a/po/kimchi.pot
+++ b/po/kimchi.pot
@@ -273,9 +273,7 @@ msgstr ""
 msgid "NFS server mount path can not be blank."
 msgstr ""
 
-msgid ""
-"Invalid storage pool name. It may only contain letters, numbers, "
-"underscores, and hyphens."
+msgid "Invalid storage pool name. It should not contain '/'."
 msgstr ""
 
 msgid "Invalid NFS mount path."
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 0d924e3..502624a 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -299,9 +299,7 @@ msgstr ""
 msgid "NFS server mount path can not be blank."
 msgstr "Caminho de montagem do servidor de NFS não pode ficar em branco."
 
-msgid ""
-"Invalid storage pool name. It may only contain letters, numbers, "
-"underscores, and hyphens."
+msgid "Invalid storage pool name. It should not contain '/'."
 msgstr ""
 
 msgid "Invalid NFS mount path."
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 361c11a..5cf9f2e 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -289,10 +289,8 @@ msgstr ""
 msgid "NFS server mount path can not be blank."
 msgstr "NFS服务器挂载路径不能为空"
 
-msgid ""
-"Invalid storage pool name. It may only contain letters, numbers, "
-"underscores, and hyphens."
-msgstr ""
+msgid "Invalid storage pool name. It should not contain '/'."
+msgstr "无效的存储池的名字。名字不能包含‘/’。"
 
 msgid "Invalid NFS mount path."
 msgstr ""
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index b634ca6..203a3f5 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -144,7 +144,7 @@ kimchi.validateForm = function() {
         kimchi.message.error.code('KCHPOOL6001E');
         return false;
     }
-    if (!/^[\w-]+$/.test(name)) {
+    if (name.contains("/")) {
         kimchi.message.error.code('KCHPOOL6004E');
         return false;
     }
diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
index 098a0a9..60d2c28 100644
--- a/ui/pages/i18n.html.tmpl
+++ b/ui/pages/i18n.html.tmpl
@@ -109,7 +109,7 @@ var i18n = {
     'KCHPOOL6001E': "$_("The storage pool name can not be blank.")",
     'KCHPOOL6002E': "$_("The storage pool path can not be blank.")",
     'KCHPOOL6003E': "$_("NFS server mount path can not be blank.")",
-    'KCHPOOL6004E': "$_("Invalid storage pool name. It may only contain letters, numbers, underscores, and hyphens.")",
+    'KCHPOOL6004E': "$_("Invalid storage pool name. It should not contain '/'.")",
     'KCHPOOL6005E': "$_("Invalid NFS mount path.")",
     'KCHPOOL6006E': "$_("No logical device selected.")",
     'KCHPOOL6007E': "$_("The iSCSI target can not be blank.")",