[Kimchi-devel] [PATCH v2 1/4] [UI] Add CDROM-related APIs

Adam King rak at linux.vnet.ibm.com
Wed Mar 5 00:36:56 UTC 2014


Reviewed-by: Adam King <rak at linux.vnet.ibm.com>
Tested-by: Adam King <rak at linux.vnet.ibm.com>

On 03/04/2014 04:01 AM, Hongliang Wang wrote:
> Add APIs for attaching CDROM to VM 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 fdd9cfc..691b2a1 100644
> --- a/ui/js/src/kimchi.api.js
> +++ b/ui/js/src/kimchi.api.js
> @@ -727,5 +727,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
> +        });
>       }
>   };


-- 
Adam King <rak at linux.vnet.ibm.com>
IBM CSI




More information about the Kimchi-devel mailing list