Sha256: 27723f306013e20cb4e9fd11ed13ddc35cfaa5265649c4a2097731888819c3b2
Contents?: true
Size: 806 Bytes
Versions: 5
Compression:
Stored size: 806 Bytes
Contents
module Fog module Compute class Libvirt class Real 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 Mock def upload_volume(pool_name, volume_name, file_path) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems