On 2014年09月04日 09:42, Aline Manera wrote:
On 09/03/2014 08:58 AM, lvroyce0210(a)gmail.com wrote:
> From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
>
> Periodically update current written bytes to task message
> so that UI can query the latest progress of volume uploading.
>
> Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
> ---
> src/kimchi/model/storagevolumes.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/model/storagevolumes.py
> b/src/kimchi/model/storagevolumes.py
> index 91abc81..7794b32 100644
> --- a/src/kimchi/model/storagevolumes.py
> +++ b/src/kimchi/model/storagevolumes.py
> @@ -73,13 +73,18 @@ class StorageVolumesModel(object):
> raise InvalidParameter('KCHVOL0001E', {'name':
params['name']})
>
> upload_file = params['file']
> + pool = StoragePoolModel.get_storagepool(pool_name, self.conn)
> try:
> + size = 0
> f = open(file_path, 'wb')
> + pool.refresh()
> while True:
> data = upload_file.file.read(8192)
> if not data:
> break
> + size += len(data)
> f.write(data)
> + cb(size, True)
Just to make download/upload consistent. In download patches, Cristian
is recording <downloaded_size>/<remote_size>
Is it possible to get the total file size prior to the upload starts?
So we can record in the same way as Cristian did
ACK
> f.close()
> except Exception as e:
> raise OperationFailed('KCHVOL0007E',
> @@ -88,9 +93,7 @@ class StorageVolumesModel(object):
> 'err': e.message})
>
> # Refresh to make sure volume can be found in following lookup
> - pool = StoragePoolModel.get_storagepool(pool_name, self.conn)
> pool.refresh()
> - cb('', True)
>
> def _create_volume_with_capacity(self, cb, params):
> pool_name = params.pop('pool')
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel