[Kimchi-devel] [PATCH v4 2/5] [UI] Add CDROM-related APIs

Aline Manera alinefm at linux.vnet.ibm.com
Mon Mar 10 17:10:47 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 03/10/2014 06:44 AM, Hongliang Wang wrote:
> Add APIs for managing guest CDROM in kimchi.api.js.
>
> Signed-off-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.api.js | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 74 insertions(+)
>
> diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
> index c93426f..3662a87 100644
> --- a/ui/js/src/kimchi.api.js
> +++ b/ui/js/src/kimchi.api.js
> @@ -729,5 +729,79 @@ var kimchi = {
>               success : suc,
>               error : err
>           });
> +    },
> +
> +    addVMStorage : function(settings, suc, err) {
> +        var vm = encodeURIComponent(settings['vm']);
> +        delete settings['vm'];
> +        kimchi.requestJSON({
> +            url : kimchi.url + 'vms/' + vm + '/storages',
> +            type : 'POST',
> +            contentType : 'application/json',
> +            data : JSON.stringify(settings),
> +            dataType : 'json',
> +            success : suc,
> +            error : err
> +        });
> +    },
> +
> +    retrieveVMStorage : function(settings, suc, err) {
> +        var vm = encodeURIComponent(settings['vm']);
> +        var dev = encodeURIComponent(settings['dev']);
> +        kimchi.requestJSON({
> +            url : kimchi.url + "vms/" + vm + '/storages/' + dev,
> +            type : 'GET',
> +            contentType : 'application/json',
> +            dataType : 'json',
> +            success: suc,
> +            error: err
> +        });
> +    },
> +
> +    replaceVMStorage : function(settings, suc, err) {
> +        var vm = encodeURIComponent(settings['vm']);
> +        var dev = encodeURIComponent(settings['dev']);
> +        kimchi.requestJSON({
> +            url : kimchi.url + 'vms/' + vm + '/storages/' + dev,
> +            type : 'PUT',
> +            contentType : 'application/json',
> +            data : JSON.stringify({
> +                path: settings['path']
> +            }),
> +            dataType : 'json',
> +            success : suc,
> +            error : err
> +        });
> +    },
> +
> +    deleteVMStorage : function(settings, suc, err) {
> +        var vm = settings['vm'];
> +        var dev = settings['dev'];
> +        kimchi.requestJSON({
> +            url : kimchi.url + 'vms/' + encodeURIComponent(vm) +
> +                      '/storages/' + encodeURIComponent(dev),
> +            type : 'DELETE',
> +            contentType : 'application/json',
> +            dataType : 'json',
> +            success : suc,
> +            error : err
> +        });
> +    },
> +
> +    listVMStorages : function(params, suc, err) {
> +        var vm = encodeURIComponent(params['vm']);
> +        var type = params['storageType'];
> +        var url = kimchi.url + 'vms/' + vm + '/storages';
> +        if(type) {
> +            url += '?type=' + type;
> +        }
> +        kimchi.requestJSON({
> +            url : url,
> +            type : 'GET',
> +            contentType : 'application/json',
> +            dataType : 'json',
> +            success : suc,
> +            error : err
> +        });
>       }
>   };




More information about the Kimchi-devel mailing list