[libvirt] [PATCH 2/3] snapshots: Introduce VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag
Michal Privoznik
mprivozn at redhat.com
Tue Jan 24 20:18:58 UTC 2012
On 24.01.2012 19:49, Jiri Denemark wrote:
> On Tue, Jan 24, 2012 at 18:37:44 +0100, Michal Privoznik wrote:
>> With this flag, virDomainSnapshotCreate will use fs-freeze and
>> fs-thaw guest agent commands to quiesce guest's disks.
>> ---
>> include/libvirt/libvirt.h.in | 4 ++
>> src/libvirt.c | 6 ++
>> src/qemu/qemu_driver.c | 118 ++++++++++++++++++++++++++++++++++++-----
>> 3 files changed, 113 insertions(+), 15 deletions(-)
>>
>> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
>> index 5e6e488..182065d 100644
>> --- a/include/libvirt/libvirt.h.in
>> +++ b/include/libvirt/libvirt.h.in
>> @@ -3125,6 +3125,10 @@ typedef enum {
>> system checkpoint */
>> VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT = (1 << 5), /* reuse any existing
>> external files */
>> + VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE = (1 << 6), /* use guest agent to
>> + quiesce all mounted
>> + file systems within
>> + the domain */
>
> Do we also want to add another flag that would make quiescing optional? That
> is, use it if it's available but don't fail if it's not.
If this is ever needed we can add it then.
>> @@ -9493,6 +9543,13 @@ qemuDomainSnapshotCreateActive(virConnectPtr conn,
>> }
>>
>> if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
>> + if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) &&
>> + (qemuDomainSnapshotFSFreeze(driver, vm) < 0)) {
>> + qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> + _("Unable to freeze domain's file systems"));
>
> This just masks useful error reported by qemuDomainSnapshotFSFreeze().
In fact, I just realized, this is dead code. Since we are checking for
DISK_ONLY flag which implies calling
qemuDomainSnapshotCreateDiskActive() we will never get this condition to
evaluate as true. I'll drop it in v2.
More information about the libvir-list
mailing list