[PATCH] : Dir Storagepool path: Git hub issue:316

Defining a New DIR based Storage Pool fails, if user appends "/" to path. For ex: If user use "/home/user/vms/" instead of "/home/user/vms", it fails with " Not a valid linux path" Issue: https://github.com/kimchi-project/kimchi/issues/316 Signed-off-by: Chandan Kumar<psuriset@linux.vnet.ibm.com> Reviewed-by: Pradeep K Surisetty <psuriset@linux.vnet.ibm.com> --- ui/js/src/kimchi.storagepool_add_main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js index e5922b3..a5a12f7 100644 --- a/ui/js/src/kimchi.storagepool_add_main.js +++ b/ui/js/src/kimchi.storagepool_add_main.js @@ -167,7 +167,7 @@ kimchi.validateDirForm = function () { kimchi.message.error(i18n['msg.pool.edit.path.blank']); return false; } - if (!/((\/([0-9a-zA-Z-_\.]+)))$/.test(path)) { + if (!/((\/([0-9a-zA-Z-_\.]+)))(\/|[0-9a-zA-Z-_\.])$/.test(path)) { kimchi.message.error(i18n['msg.validate.pool.edit.path']); return false; } -- 1.8.3.1

Why do we need to use a regexp against the storage pool path at all? Anything can be a valid path in Linux. Even if it has spaces, non-ASCII characters, etc. The only validation that seems useful to me is to check if the path exists (which I believe it's done by the backend). The current code is limiting which paths we can use as storage pool in Kimchi, when they're perfectly fine with libvirt. I just created a local storage pool with the path "/home/vianac/crístian viana" (notice the space and the non-ASCII character) using virsh and it worked just fine. Am 12-02-2014 12:03, schrieb Pradeep K Surisetty:
Defining a New DIR based Storage Pool fails, if user appends "/" to path. For ex: If user use "/home/user/vms/" instead of "/home/user/vms", it fails with " Not a valid linux path"
Issue: https://github.com/kimchi-project/kimchi/issues/316
Signed-off-by: Chandan Kumar<psuriset@linux.vnet.ibm.com> Reviewed-by: Pradeep K Surisetty <psuriset@linux.vnet.ibm.com>

On 02/12/2014 10:14 PM, Crístian Viana wrote:
Why do we need to use a regexp against the storage pool path at all? Anything can be a valid path in Linux. Even if it has spaces, non-ASCII characters, etc. agree. international is one of important feature of kimchi.
we just keep the same limit of libvirt.
The only validation that seems useful to me is to check if the path exists (which I believe it's done by the backend). The current code is limiting which paths we can use as storage pool in Kimchi, when they're perfectly fine with libvirt.
I just created a local storage pool with the path "/home/vianac/crístian viana" (notice the space and the non-ASCII character) using virsh and it worked just fine.
Am 12-02-2014 12:03, schrieb Pradeep K Surisetty:
Defining a New DIR based Storage Pool fails, if user appends "/" to path. For ex: If user use "/home/user/vms/" instead of "/home/user/vms", it fails with " Not a valid linux path"
Issue: https://github.com/kimchi-project/kimchi/issues/316
Signed-off-by: Chandan Kumar<psuriset@linux.vnet.ibm.com> Reviewed-by: Pradeep K Surisetty <psuriset@linux.vnet.ibm.com>
_______________________________________________ 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
participants (3)
-
Crístian Viana
-
Pradeep K Surisetty
-
Sheldon