[Kimchi-devel] [WIP PATCH] Storage DL/UL

Aline Manera alinefm at linux.vnet.ibm.com
Wed Sep 10 00:25:46 UTC 2014


> I am getting the following error while trying to upload a file into a 
> storage pool:
>
>
>
>
> After some investigation I realized it is because you set the 
> contentType as false (ie, '*/*') so Kimchi server will try to return a 
> HTML according to the resource.
> In this case a Task resource. So it looks for a file: 
> /home/alinefm/kimchi/ui/pages/Task.tmpl which does not exist and then 
> the 404 error is reported.
>
> Check src/kimchi/template.py
>
> def can_accept_html():
>     return can_accept('text/html') or \
>            can_accept('application/xaml+xml') or \
>            can_accept('*/*')
>
> To solve this issue, we can change AsyncCollection 
> (src/kimchi/control/base.py) to always return a JSON (see patch below)
>

Hey, seems the solution is really simpler than that.
You just need to set dataType to json (while doing the upload request) 
so the response will be JSON. ;-)

diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 766df6a..37d1c74 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1141,6 +1141,7 @@ var kimchi = {
          kimchi.requestJSON({
              url : kimchi.url + 'storagepools/' + sp + '/storagevolumes',
              type : 'POST',
+            dataType : 'json',
              data : fd,
              processData : false,
              contentType : false,





More information about the Kimchi-devel mailing list