On 06/14/2014 06:01 PM, Sheldon wrote:
On 06/13/2014 07:52 PM, Aline Manera wrote:
On 06/13/2014 04:43 AM, Sheldon wrote:
On 06/13/2014 04:58 AM, Aline Manera wrote:
On 06/12/2014 08:19 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>

Both '-' and '_' are allowed by libvirt,  so we should not put extra
restrictions.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
---
 ui/js/src/kimchi.network.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 23930cd..c6e828d 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -321,7 +321,7 @@ kimchi.cleanNetworkDialog = function() {

 kimchi.setupNetworkFormEvent = function() {
     $("#networkName").on("keyup", function(event) {
-        $("#networkName").toggleClass("invalid-field", !$("#networkName").val().match(/^[a-zA-Z0-9_]+$/));
+        $("#networkName").toggleClass("invalid-field", !$("#networkName").val().match(/^[\-\w]+$/));
         kimchi.updateNetworkFormButton();
     });
     $("#networkTypeIso").on("click", function(event) {

I agree with Cristian.
You should remove the whole line:

$("#networkName").toggleClass("invalid-field", !$("#networkName").val().match(/^[a-zA-Z0-9_]+$/));

what about some little restrictions than libvirt.
such as  wildcard "*", "?" and "/", [], {} ! are not allowed. 


Yes, we need to restrict only the characters not allowed by libvirt
so only "/" is  restricted? the same rule with VM name and storage-pool name?

for  wildcard can be used in shell. such as:
$ ls dat*
debugreports  objectstore  screenshots  sessions
$ ls dat?
debugreports  objectstore  screenshots  sessions
$ ls data
debugreports  objectstore  screenshots  sessions
$ ls [d]ata
debugreports  objectstore  screenshots  sessions

shell meta characters and control operator should we support?
" ' ` = $ < > | & ( ) { } ; && || !
I have do some test as follow:

1.
I rename the network as "dd/ddd", libvirt will  report an error:
create file '/etc/libvirt/qemu/networks/dd/ddd.xml.new': No such file or directory
We do can help libvirt to escape "/". And seems linux support every character.


It is because '/' is a special character in xml files.
Seems it is not the xml special character.
$ touch dd\/ddd.xml
touch: cannot touch ‘dd/ddd.xml’: No such file or directory.

"\" may cause a big trouble.
I'd like to not escape "\", what about you?

seems only "< & >" are xml special characters.
We need to scape it.

2.
I also create a network named "*.efault",  kimchi can work works well, that's kimchi UI's problem.
it report: "Error: Syntax error, unrecognized expression: #*.efault
".
I can also fix this problem.


Please, send a patch for it too

virsh # net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 *.efault             inactive   yes           yes
 brg20                active     yes           yes
 dddd                 active     yes           yes
 default              active     yes           yes
 test_abc             active     yes           yes

strangely, I can not list the persistent network  *.efault.xml file.
$ sudo ls  /var/lib/libvirt/network/
dddd.xml  default.xml  test_abc.xml








-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com>
IBM Linux Technology Center



-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com>
IBM Linux Technology Center


_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com>
IBM Linux Technology Center