* Image upload buffer length reduced.

* Error handling fixed to correspond to correct translation.
This commit is contained in:
pradels
2013-07-10 16:26:52 +02:00
parent 93d59b1600
commit 4776846e9e
2 changed files with 9 additions and 2 deletions

View File

@@ -96,7 +96,14 @@ module VagrantPlugins
volume = pool.lookup_volume_by_name(volume_name)
stream = env[:libvirt_compute].client.stream
volume.upload(stream, offset=0, length=image_size)
buf_size = 1024*1024 # 1M
# Exception Libvirt::RetrieveError can be raised if buffer is
# longer than length accepted by API send function.
#
# TODO: How to find out if buffer is too large and what is the
# length that send function will accept?
buf_size = 1024*250 # 250K
progress = 0
open(image_file, 'rb') do |io|
while (buff = io.read(buf_size)) do

View File

@@ -25,7 +25,7 @@ module VagrantPlugins
end
class ImageUploadError < VagrantLibvirtError
error_key(:image_upload_error_error)
error_key(:image_upload_error)
end