[DRE-commits] [vagrant-libvirt] 52/104: * Image upload buffer length reduced. * Error handling fixed to correspond to correct translation.
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Apr 24 13:55:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to annotated tag 0.0.11
in repository vagrant-libvirt.
commit 4776846e9e857bd50cfa514a265fd39883138524
Author: pradels <les.pradels at gmail.com>
Date: Wed Jul 10 16:26:52 2013 +0200
* Image upload buffer length reduced.
* Error handling fixed to correspond to correct translation.
---
lib/vagrant-libvirt/action/handle_box_image.rb | 9 ++++++++-
lib/vagrant-libvirt/errors.rb | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git
More information about the Pkg-ruby-extras-commits
mailing list