virDomainBlockInfo for local volume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am using virStorageVolGetInfo to get the volume size virStorageVol.download to download a
normal file for VDSM project.

I want to add support for block devices as well, I was able to see the size
via virDomainBlockInfo and download via virDomain.blockPeek which is works
fine for both file and block device.

1. Can I depend on virDomainBlockInfo for non block devices?
2. Does the virDomainBlockInfo return the correct physical size for normal file?
3. Performance wise do we have a difference between virStorageVol.download and virDomain.blockPeek?


Assuming the VMs are down, this is the code I intend to use for all formats:

vm = con.lookupByName(options.vmname)
info = vm.blockInfo(src)
physical = info[2]

off = 0
size = 0
with open(dest, 'w+') as f:
    while off < physical:
        if (physical - off) < bufsize:
            size = physical - off
        else:
            size = bufsize
        buf = vm.blockPeek(src, off, size)
        f.write(buf)
        off += size

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users



[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux