| |   |
| 3 | 3 | import org.libvirt.jna.DomainPointer; |
| 4 | 4 | import org.libvirt.jna.DomainSnapshotPointer; |
| 5 | 5 | import org.libvirt.jna.Libvirt; |
| import org.libvirt.jna.virDomainBlockInfo; |
| 6 | 7 | import org.libvirt.jna.virDomainBlockStats; |
| 7 | 8 | import org.libvirt.jna.virDomainInfo; |
| 8 | 9 | import org.libvirt.jna.virDomainInterfaceStats; |
| … | … | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| * This function returns block device (disk) stats for block devices |
| * attached to the domain. |
| * |
| * @param path |
| * the path to the block device |
| * @return the info, or null if an error |
| * @throws LibvirtException |
| */ |
| public DomainBlockInfo blockInfo(String path) throws LibvirtException { |
| virDomainBlockInfo info = new virDomainBlockInfo(); |
| int success = libvirt.virDomainGetBlockInfo(VDP, path, info, 0); |
| processError(); |
| return success == 0 ? new DomainBlockInfo(info) : null; |
| } |
|
| /** |
| 126 | 142 | * Returns block device (disk) stats for block devices attached to this |
| 127 | 143 | * domain. The path parameter is the name of the block device. Get this by |
| 128 | 144 | * calling virDomainGetXMLDesc and finding the <target dev='...'> attribute |
| … | … | |
| 155 | 155 | */ |
| 156 | 156 | public DomainBlockStats blockStats(String path) throws LibvirtException { |
| 157 | 157 | virDomainBlockStats stats = new virDomainBlockStats(); |
| libvirt.virDomainBlockStats(VDP, path, stats, stats.size()); |
| int success = libvirt.virDomainBlockStats(VDP, path, stats, stats.size()); |
| 159 | 159 | processError(); |
| return new DomainBlockStats(stats); |
| return success == 0 ? new DomainBlockStats(stats) : null; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| … | … | |
| 533 | 533 | /** |
| 534 | 534 | * Determine if the domain has a snapshot |
| 535 | 535 | * |
| * @see <a href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainHasCurrentSnapshot>Libvir |
| * t Documentation</a> |
| * @see <a href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainHasCurrentSnapshot>Libvi |
| * r t Documentation</a> |
| 538 | 538 | * @return 1 if running, 0 if inactive, -1 on error |
| 539 | 539 | * @throws LibvirtException |
| 540 | 540 | */ |
| … | … | |
| 547 | 547 | /** |
| 548 | 548 | * Determine if the domain has a managed save image |
| 549 | 549 | * |
| * @see <a href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainHasManagedSaveImage>Libvir |
| * t Documentation</a> |
| * @see <a href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainHasManagedSaveImage>Libvi |
| * r t Documentation</a> |
| 552 | 552 | * @return 0 if no image is present, 1 if an image is present, and -1 in |
| 553 | 553 | * case of error |
| 554 | 554 | * @throws LibvirtException |