[PATCH] bug fix: accept '-' & '_' for network name.

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) { -- 1.9.3

On 12-06-2014 08:19, 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.
I don't think this patch is valid because libvirt support any name as a network name (and VM name, storage pool name...). If we're actually not putting extra restrictions, let the user type anything for the network name that's also valid in libvirt (i.e. spaces, special characters). You can even have Chinese/Japanese/Korean characters in network names: $ sudo virsh net-list Name State Autostart Persistent ---------------------------------------------------------- default active yes yes 크리스티안 active no no

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_]+$/));

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. 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. 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. 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

On 06/13/2014 03:43 PM, 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.
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.
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.
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 sorry, the *.efault is not active. not can not list it.
another problems I create a "dddd " network, with a space after it. virsh # net-list --all Name State Autostart Persistent ---------------------------------------------------------- *.efault active yes yes brg20 active yes yes dddd active yes yes dddd active yes yes default active yes yes test_abc active yes yes looks like strangely, there are two same networks. but they are not. one is "dddd" another is "dddd "
-- 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

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
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. 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

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. 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

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

I'd like to give up to support ". " is not allowed by dnsmasq. the number of " but be even ERROR:cherrypy.error.62418064:[14/Jun/2014:23:11:44] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: internal error: Child process (/sbin/dnsmasq '--conf-file=/var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'\''`"::::?><\.conf') unexpected exit status 1: dnsmasq: missing " at line 10 of /var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'`"::::?><\.conf I create a network with name "ab", with contains two ". also error. ERROR:cherrypy.error.62418064:[14/Jun/2014:23:24:49] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: An error occurred, but the cause is unknown On 06/14/2014 10:16 PM, Sheldon wrote:
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
_______________________________________________ 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

On 06/14/2014 12:30 PM, Sheldon wrote:
I'd like to give up to support ".
" is not allowed by dnsmasq. the number of " but be even
ACK.
ERROR:cherrypy.error.62418064:[14/Jun/2014:23:11:44] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: internal error: Child process (/sbin/dnsmasq '--conf-file=/var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'\''`"::::?><\.conf') unexpected exit status 1: dnsmasq: missing " at line 10 of /var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'`"::::?><\.conf
I create a network with name "ab", with contains two ". also error.
ERROR:cherrypy.error.62418064:[14/Jun/2014:23:24:49] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: An error occurred, but the cause is unknown
On 06/14/2014 10:16 PM, Sheldon wrote:
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
_______________________________________________ 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

From your experiments and explanations, I can see though libvirt put little restriction on names, but it does not handle the names correctly when it contains special chars. To make support all these special chars, we have to escape them in Kimchi. However consider there is several level to escape, html, xml, shell names, dnsmasq. It makes the escape rules complicated. These are only the common tools Kimchi usually works with. It's unpredictable if it would cause trouble when the admin uses other tools. In this terms, libvirt is actually broken, because it allows special chars but it does not process it correctly.
From my opinion, Kimchi should filter out ~`!@#$%^&*()=+{}[]\|;:'"/?.>,< It implies, a to z, A to Z, underscore, dash and whitespace are supported. Unicode chars should be also supported.
on 2014/06/14 23:30, Sheldon wrote:
I'd like to give up to support ".
" is not allowed by dnsmasq. the number of " but be even
ERROR:cherrypy.error.62418064:[14/Jun/2014:23:11:44] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: internal error: Child process (/sbin/dnsmasq '--conf-file=/var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'\''`"::::?><\.conf') unexpected exit status 1: dnsmasq: missing " at line 10 of /var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'`"::::?><\.conf
I create a network with name "ab", with contains two ". also error.
ERROR:cherrypy.error.62418064:[14/Jun/2014:23:24:49] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: An error occurred, but the cause is unknown
On 06/14/2014 10:16 PM, Sheldon wrote:
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
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Zhou Zheng Sheng / 周征晟 E-mail: zhshzhou@linux.vnet.ibm.com Telephone: 86-10-82454397

on 2014/06/16 15:06, Zhou Zheng Sheng wrote:
From your experiments and explanations, I can see though libvirt put little restriction on names, but it does not handle the names correctly when it contains special chars. To make support all these special chars, we have to escape them in Kimchi. However consider there is several level to escape, html, xml, shell names, dnsmasq. It makes the escape rules complicated. These are only the common tools Kimchi usually works with. It's unpredictable if it would cause trouble when the admin uses other tools. In this terms, libvirt is actually broken, because it allows special chars but it does not process it correctly.
From my opinion, Kimchi should filter out ~`!@#$%^&*()=+{}[]\|;:'"/?.>,< It implies, a to z, A to Z, underscore, dash and whitespace are supported. Unicode chars should be also supported.
Sorry, 0 to 9, and dot should also be supported, I forgot to mention them.
on 2014/06/14 23:30, Sheldon wrote:
I'd like to give up to support ".
" is not allowed by dnsmasq. the number of " but be even
ERROR:cherrypy.error.62418064:[14/Jun/2014:23:11:44] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: internal error: Child process (/sbin/dnsmasq '--conf-file=/var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'\''`"::::?><\.conf') unexpected exit status 1: dnsmasq: missing " at line 10 of /var/lib/libvirt/dnsmasq/@#$%^&*()_+=-!~|{}[];'`"::::?><\.conf
I create a network with name "ab", with contains two ". also error.
ERROR:cherrypy.error.62418064:[14/Jun/2014:23:24:49] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py", line 72, in wrapper ident = fn(*model_args) File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/networks.py", line 308, in activate network.create() File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper ret = f(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2318, in create if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self) libvirtError: An error occurred, but the cause is unknown
On 06/14/2014 10:16 PM, Sheldon wrote:
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
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Zhou Zheng Sheng / 周征晟 E-mail: zhshzhou@linux.vnet.ibm.com Telephone: 86-10-82454397
participants (5)
-
Aline Manera
-
Crístian Viana
-
shaohef@linux.vnet.ibm.com
-
Sheldon
-
Zhou Zheng Sheng