get contents of a storage volume in bytes

Daniel P. Berrange dan at berrange.com
Sun Jun 28 21:25:45 UTC 2020


On Sun, Jun 28, 2020 at 07:51:01PM +0530, Shashwat shagun wrote:
> Hi, i have two machines with libvirt installed. I want to move a storage
> volume from the 1st machine to 2nd machine with code.
> 
> I'm thinking of reading a storage volume into a byte array/stream then
> uploading through my own/custom handler (written in go) to the 2nd
> machine's custom handler which will then be writing the byte stream to
> libvirt storage volume.
> 
> Is there a libvirt function to read storage volume into byte stream?

You can use the Download & Upload methods on the StorageVol object

  https://godoc.org/libvirt.org/libvirt-go#StorageVol.Download
  https://godoc.org/libvirt.org/libvirt-go#StorageVol.Upload

Together with the stream object

  https://godoc.org/libvirt.org/libvirt-go#Stream

Regards,
Daniel
--
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list