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

Sheldon shaohef at linux.vnet.ibm.com
Sat Jun 14 15:30:04 UTC 2014


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 at linux.vnet.ibm.com wrote:
>>>>>> From: ShaoHe Feng<shaohef at linux.vnet.ibm.com>
>>>>>>
>>>>>> Both '-' and '_' are allowed by libvirt,  so we should not put extra
>>>>>> restrictions.
>>>>>>
>>>>>> Signed-off-by: ShaoHe Feng<shaohef at 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 at linux.vnet.ibm.com>
>>>> IBM Linux Technology Center
>>>
>>
>>
>> -- 
>> Thanks and best regards!
>>
>> Sheldon Feng(???)<shaohef at linux.vnet.ibm.com>
>> IBM Linux Technology Center
>>
>>
>> _______________________________________________
>> Kimchi-devel mailing list
>> Kimchi-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
>
> -- 
> Thanks and best regards!
>
> Sheldon Feng(???)<shaohef at linux.vnet.ibm.com>
> IBM Linux Technology Center
>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel


-- 
Thanks and best regards!

Sheldon Feng(???)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140614/10a262ff/attachment.html>


More information about the Kimchi-devel mailing list