diff --git a/lib/vagrant-libvirt/action/handle_box_image.rb b/lib/vagrant-libvirt/action/handle_box_image.rb index 2b621d7..45b7691 100644 --- a/lib/vagrant-libvirt/action/handle_box_image.rb +++ b/lib/vagrant-libvirt/action/handle_box_image.rb @@ -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 diff --git a/lib/vagrant-libvirt/errors.rb b/lib/vagrant-libvirt/errors.rb index 1aafa85..322bf6a 100644 --- a/lib/vagrant-libvirt/errors.rb +++ b/lib/vagrant-libvirt/errors.rb @@ -25,7 +25,7 @@ module VagrantPlugins end class ImageUploadError < VagrantLibvirtError - error_key(:image_upload_error_error) + error_key(:image_upload_error) end