Sha256: d805d3fc98e3a779ee3f819309e55df5c76fbc0de5c611d3a220fde76ed885ae
Contents?: true
Size: 810 Bytes
Versions: 3
Compression:
Stored size: 810 Bytes
Contents
module Fog module Libvirt class Compute module Shared def upload_volume(pool_name, volume_name, file_path) volume = client.lookup_storage_pool_by_name(pool_name).lookup_volume_by_name(volume_name) stream = client.stream image_file = File.open(file_path, "rb") volume.upload(stream, 0, image_file.size) stream.sendall do |_opaque, n| begin r = image_file.read(n) r ? [r.length, r] : [0, ""] rescue Exception => e [-1, ""] end end stream.finish ensure image_file.close if image_file end end class Real include Shared end class Mock include Shared end end end end
Version data entries
3 entries across 3 versions & 1 rubygems