Libvirt provides a portable, long term stable C API for managing the virtualization technologies provided by many operating systems. It includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER Hypervisor.
Go to file
John Ferlan b9b1aa6392 qemu: Adjust qemuDomainGetBlockInfo data for sparse backed files
According to commit id '0282ca45a' the 'physical' value should
essentially be the last offset of the image or the host physical
size in bytes of the image container. However, commit id '15fa84ac'
refactored the GetBlockInfo to use the same returned data as the
GetStatsBlock API for an active domain. For the 'entry->physical'
that would end up being the "actual-size" as set through the
qemuMonitorJSONBlockStatsUpdateCapacityOne (commit '7b11f5e5').
Digging deeper into QEMU code one finds that actual_size is
filled in using the same algorithm as GetBlockInfo has used for
setting the 'allocation' field when the domain is inactive.

The difference in values is seen primarily in sparse raw files
and other container type files (such as qcow2), which will return
a smaller value via the stat API for 'st_blocks'. Additionally
for container files, the 'capacity' field (populated via the
QEMU "virtual-size" value) may be slightly different (smaller)
in order to accomodate the overhead for the container. For
sparse files, the state 'st_size' field is returned.

This patch thus alters the allocation and physical values for
sparse backed storage files to be more appropriate to the API
contract. The result for GetBlockInfo is the following:

 capacity: logical size in bytes of the image (how much storage
           the guest will see)
 allocation: host storage in bytes occupied by the image (such
             as highest allocated extent if there are no holes,
             similar to 'du')
 physical: host physical size in bytes of the image container
           (last offset, similar to 'ls')

NB: The GetStatsBlock API allows a different contract for the
values:

 "block.<num>.allocation" - offset of the highest written sector
                            as unsigned long long.
 "block.<num>.capacity" - logical size in bytes of the block device
                          backing image as unsigned long long.
 "block.<num>.physical" - physical size in bytes of the container
                          of the backing image as unsigned long long.
2016-12-20 12:56:44 -05:00
.gnulib@c3b131294a build: update to latest gnulib 2016-11-15 10:26:58 -06:00
build-aux prohibit-duplicate-header: print file name and line 2016-06-23 12:48:40 +02:00
daemon admin: Introduce virAdmConnectSetLoggingFilters 2016-12-15 10:36:23 +01:00
docs docs: link to news file and other resources 2016-12-19 10:58:55 +00:00
examples examples: Resolve sign-compare warnings 2016-12-20 13:11:25 +01:00
gnulib build: drop hack for old mingw ssize_t 2016-07-12 08:57:13 -06:00
include/libvirt perf: add ref_cpu_cycles perf event support 2016-12-15 17:32:03 -05:00
m4 m4/virt-lib: properly pass header_name in LIBVIRT_CHECK_LIB(_ALT) 2016-12-07 16:21:31 +01:00
po Move virstat.c code to virnetdevtap.c 2016-12-09 10:28:07 +01:00
src qemu: Adjust qemuDomainGetBlockInfo data for sparse backed files 2016-12-20 12:56:44 -05:00
tests tests: Add tests for disk configuration validation 2016-12-20 11:34:30 +01:00
tools perf: add ref_cpu_cycles perf event support 2016-12-15 17:32:03 -05:00
.ctags
.dir-locals.el
.gitignore admin: Add an example demonstrating how to use the logging APIs 2016-12-15 10:36:23 +01:00
.gitmodules
.mailmap
AUTHORS.in
autobuild.sh maint: Switch to xz compressed PAX release archives 2016-06-15 18:53:34 +02:00
autogen.sh
bootstrap build: update to latest gnulib 2016-11-12 14:51:52 -06:00
bootstrap.conf hvsupport: use a regex instead of XML::XPath 2016-07-19 18:42:44 +02:00
cfg.mk nssmock: Prefer free() over VIR_FREE() 2016-12-06 13:33:18 +01:00
ChangeLog-old
config-post.h virfile: Introduce ACL helpers 2016-12-15 09:25:16 +01:00
configure.ac configure: Link witch -lacl only on linux 2016-12-16 11:51:06 +00:00
COPYING
COPYING.LESSER
HACKING docs: remove outdated suggestion to make patches with "diff -urp"/"git diff" 2016-07-01 12:41:10 -04:00
libvirt-admin.pc.in
libvirt-lxc.pc.in
libvirt-qemu.pc.in
libvirt.pc.in
libvirt.spec.in libvirt.spec: Package libnss_libvirt_guest.so.2 2016-12-08 15:25:17 +01:00
Makefile.am dist: Speed up distribution compression 2016-06-30 16:05:24 +02:00
Makefile.nonreentrant cfg.mk: use a single regex for all non-reentrant functions 2016-06-15 15:00:56 +02:00
mingw-libvirt.spec.in test: fix screenshot API impl 2016-12-08 10:57:32 +00:00
README
README-hacking
run.in
TODO

         LibVirt : simple API for virtualization

  Libvirt is a C toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). It is free software
available under the GNU Lesser General Public License. Virtualization of
the Linux Operating System means the ability to run multiple instances of
Operating Systems concurrently on a single hardware system where the basic
resources are driven by a Linux instance. The library aim at providing
long term stable C API initially for the Xen paravirtualization but
should be able to integrate other virtualization mechanisms if needed.

Daniel Veillard <veillard@redhat.com>