On 2014年08月19日 08:42, Crístian Viana wrote:
The following API changes should be made to implement the remote
download ISO feature:
1) POST /storagepools/ISO/storagevolumes/download {'url':
<http|https|ftp|ftps>, 'name': <volume name>}
Description: Starts downloading a remote ISO image to Kimchi's storage
pool.
Parameters:
'url': specifies where the image is hosted. Required.
'name': specifies the name of the local file when the download
finishes. If this parameter is omitted, Kimchi will try to use the
same file name as the remote file. Optional.
Return codes:
200: the remote URL is valid and the download started successfully.
400: the remote URL is not valid;
Cristian,
Thanks for this comprehensive and detailed RFC which we can take as a
good example! Some suggestion according to me below:
1. As for me, if download/upload is a time consuming task, we may want
to use AsyncTask to track it.
So for POST /storagepools/ISO/storagevolumes/download we may want to
return 202 and a 'task_id' in the response data.
2.To query status, pause and cancel the download, the target will be the
task:
POST /tasks/download-task-id/cancel
This may require enhancement of tasks API.
the provided 'name' is already in use (this error
shouldn't happen if
'name' is omitted).
the storage pool doesn't have enough free space to hold the remote file.
Return data:
{'name': <vol-name>}
2) POST /storagepools/ISO/storagevolumes/download/pause {'name':
<volume name>}
Description: Pauses a remote ISO download.
Parameters:
'name': the remote volume name to be paused. Required.
Return codes:
200: 'name' is an ongoing download file and the operation was paused
successfully.
400: 'name' is an invalid volume name (doesn't exist / isn't an
ongoing download);
download referred by 'name' cannot be paused.
Return data:
{}
3) POST /storagepools/ISO/storagevolumes/download/resume {'name':
<volume name>}
Description: Resumes a paused remote ISO download.
Parameters:
'name': the remote volume name to be resumed. Required.
Return codes:
200: 'name' is a paused download file and the operation was resumed
successfully.
400: 'name' is an invalid volume name (doesn't exist / isn't a paused
download).
Return data:
{}
4) POST /storagepools/ISO/storagevolumes/download/cancel {'name':
<volume name>}
Description: Cancels a remote ISO download.
Parameters:
'name': the remote volume name to be canceled. Required.
Return codes:
200: 'name' is an ongoing download file and the operation was canceled
successfully. Whatever data has been downloaded so far should be deleted.
400: 'name' is an invalid volume name (doesn't exist / isn't an
ongoing download).
Return data:
{}
5) POST /storagepools/ISO/storagevolumes/download/status {'name':
<volume name>}
Description: Provides status of a remote ISO download.
Parameters:
'name': the remote volume name. Required.
Return codes:
200: 'name' is a download file and its status information was returned
successfully.
400: 'name' is an invalid volume name (doesn't exist / isn't a remote
download).
Return data:
{'name': <volume name>, 'status': [downloading|paused],
'total_size':
<size in bytes>, 'downloaded_size': <size in bytes>}
I tried to put together the feedback given in another e-mail thread,
especially by Aline, Royce and Yu Xin Huo, along with some ideas of my
own. This RFC doesn't support choosing a different storage pool other
than "ISO" to host the downloaded files. If we're doing this, wel need
to update this new API accordingly.
The implementation details will be discussed later.
Please share your feedback with us.
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel