Block info query: Add check for transient domain

Currently the qemuDomainGetBlockInfo will return allocation == physical
for most backing stores. For a qcow2 block backed device it's possible
to return the highest lv extent allocated from qemu for an active guest.
That is a value where allocation != physical and one would hope be less.
However, if the guest is not running, then the code falls back to returning
allocation == physical. This turns out to be problematic for rhev which
monitors the size of the backing store. During a migration, before the
VM has been started on the target and while it is deemed inactive on the
source, there's a small window of time where the allocation is returned
as physical triggering the code to extend the file unnecessarily.

Since rhev uses transient domains and this is edge condition for a transient
domain, rather than returning good status and allocation == physical when
this "window of opportunity" exists, this patch will check for a transient
(or non persistent) domain and return a failure to the caller rather than
returning the defaults. For a persistent domain, the defaults will be
returned. The description for the virDomainGetBlockInfo has been updated
to describe the phenomena.
This commit is contained in:
John Ferlan
2013-12-17 16:47:28 -05:00
parent 68b0ff45f5
commit 46a0737e13
3 changed files with 82 additions and 8 deletions

View File

@@ -2140,7 +2140,8 @@ int virDomainBlockResize (virDomainPtr dom,
/** virDomainBlockInfo:
*
* This struct provides information about the size of a block device backing store
* This struct provides information about the size of a block device
* backing store
*
* Examples:
*
@@ -2153,11 +2154,12 @@ int virDomainBlockResize (virDomainPtr dom,
*
* - qcow2 file in filesystem
* * capacity: logical size from qcow2 header
* * allocation, physical: logical size of the file / highest qcow extent (identical)
* * allocation, physical: logical size of the file /
* highest qcow extent (identical)
*
* - qcow2 file in a block device
* * capacity: logical size from qcow2 header
* * allocation: highest qcow extent written
* * allocation: highest qcow extent written for an active domain
* * physical: size of the block device container
*/
typedef struct _virDomainBlockInfo virDomainBlockInfo;