Provides APIs for the management of domain backups Copyright (C) 2017 Parallels International GmbH This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
typedef struct _virDomainBlockSnapshotX virDomainBlockSnapshotX typedef enum virDomainBlockSnapshotXCreateFlags typedef virDomainBlockSnapshotX * virDomainBlockSnapshotXPtr
int virDomainBlockCheckpointXRemove (virDomainPtr domain,
const char * name,
unsigned int flags) int virDomainBlockExportXStart (virDomainPtr domain,
const char * xmlDesc,
unsigned int flags) int virDomainBlockExportXStop (virDomainPtr domain,
const char * xmlDesc,
unsigned int flags) virDomainBlockSnapshotXPtr virDomainBlockSnapshotXCreateXML (virDomainPtr domain,
const char * xmlDesc,
unsigned int flags) int virDomainBlockSnapshotXDelete (virDomainBlockSnapshotXPtr snapshot,
unsigned int flags) int virDomainBlockSnapshotXFree (virDomainBlockSnapshotXPtr snapshot) virConnectPtr virDomainBlockSnapshotXGetConnect (virDomainBlockSnapshotXPtr snapshot) virDomainPtr virDomainBlockSnapshotXGetDomain (virDomainBlockSnapshotXPtr snapshot) const char * virDomainBlockSnapshotXGetName (virDomainBlockSnapshotXPtr snapshot) char * virDomainBlockSnapshotXGetXMLDesc (virDomainBlockSnapshotXPtr snapshot,
unsigned int flags) int virDomainBlockSnapshotXList (virDomainPtr domain,
virDomainBlockSnapshotXPtr ** snaps,
unsigned int flags) virDomainBlockSnapshotXPtr virDomainBlockSnapshotXLookupByName (virDomainPtr domain,
const char * name,
unsigned int flags) int virDomainBlockSnapshotXRef (virDomainBlockSnapshotXPtr snapshot)
virDomainBlockSnapshotX
¶
struct virDomainBlockSnapshotX {
}
virDomainBlockSnapshotXCreateFlags
¶
enum virDomainBlockSnapshotXCreateFlags {
VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_QUIESCE | = | 1 (0x1; 1 << 0) |
use guest agent to quiesce all mounted file systems within the domain
|
VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_AUTODELETE | = | 2 (0x2; 1 << 1) |
TODO
|
VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_CHECKPOINT | = | 4 (0x4; 1 << 2) |
TODO
|
VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_BYPASS_CACHE | = | 8 (0x8; 1 << 3) |
TODO
|
}
virDomainBlockCheckpointXRemove
¶
int virDomainBlockCheckpointXRemove (virDomainPtr domain, const char * name, unsigned int flags)
Delete the checkpoint from all domain disks.
virDomainBlockExportXStart
¶
int virDomainBlockExportXStart (virDomainPtr domain, const char * xmlDesc, unsigned int flags)
Export disks/snapshots via the protocol specified in xmlDesc
. The export server will be started if it is not yet running.
Block snaphots can only be exported in the read mode. Disks can be exported in the write mode only if both VIR_DOMAIN_START_PAUSED and VIR_DOMAIN_START_X_EXPORTABLE are set on domain start and only before the domain is resumed.
virDomainBlockExportXStop
¶
int virDomainBlockExportXStop (virDomainPtr domain, const char * xmlDesc, unsigned int flags)
Delete disks/snapshots from the export through the protocol specified in xmlDesc
. The export server will be shut down if nothing is left to export.
virDomainBlockSnapshotXCreateXML
¶
virDomainBlockSnapshotXPtr virDomainBlockSnapshotXCreateXML (virDomainPtr domain, const char * xmlDesc, unsigned int flags)
Create a block snapshot based on the XML description in xmlDesc
. Block snapshots differ from plain domain disk snapshots. A plain snapshot creates a new image file backed by the original image file. The new data written to disk goes to the new image while the original image holds the data for the moment the snapshot was taken at. A block snaphot also creates a new image file backed by the original image file, but the new data still goes to the original image. Before the new data is written to the original image, however, the previous data is written to a new image (sometimes called a fleece image). As a result, the fleece image maintains the disk snapshot.
If flags
includes VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_CHECKPOINT, then a checkpoint will be added to every disk in the snapshot. The checkpoint provides the means to query which parts of disk have changed since the checkpoint was created. This is typically used for creating incremental backups. For example, if the first snapshot was created with a checkpoint and copied to the backup store, when the second snapshot is created, the backup agent can just copy the parts of disk that have changed since the first backup.
If flags
includes VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_AUTODELETE, then block snapshot will be deleted on client disconnect.
If flags
includes VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_QUIESCE, then libvirt will attempt to use the guest agent to freeze and thaw all file systems in use within the domain OS. If, however, the guest agent is not present, an error will be thrown.
If flags
includes VIR_DOMAIN_BLOCK_SNAPSHOT_X_CREATE_BYPASS_CACHE, then libvirt will attempt to bypass the file system cache while writing to the fleece image, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS.
virDomainBlockSnapshotXDelete
¶
int virDomainBlockSnapshotXDelete (virDomainBlockSnapshotXPtr snapshot, unsigned int flags)
Delete the snapshot. Fleece images are discared but checkpoints are kept.
virDomainBlockSnapshotXFree
¶
int virDomainBlockSnapshotXFree (virDomainBlockSnapshotXPtr snapshot)
Free the domain snapshot object. The snapshot itself is not modified. The data structure is freed and must not be used thereafter.
virDomainBlockSnapshotXGetConnect
¶
virConnectPtr virDomainBlockSnapshotXGetConnect (virDomainBlockSnapshotXPtr snapshot)
Provide the connection pointer associated with a snapshot. The reference counter on the connection is not increased by this call.
WARNING: Do not use this function when writing libvirt bindings in other languages. Instead store the connection and the snapshot object together.
virDomainBlockSnapshotXGetDomain
¶
virDomainPtr virDomainBlockSnapshotXGetDomain (virDomainBlockSnapshotXPtr snapshot)
Provide the domain pointer associated with a snapshot. The reference counter on the domain is not increased by this call.
WARNING: Do not use this function when writing libvirt bindings in other languages. Instead store the domain and the snapshot object together.
virDomainBlockSnapshotXGetName
¶
const char * virDomainBlockSnapshotXGetName (virDomainBlockSnapshotXPtr snapshot)
Get the name of the snapshot.
virDomainBlockSnapshotXGetXMLDesc
¶
char * virDomainBlockSnapshotXGetXMLDesc (virDomainBlockSnapshotXPtr snapshot, unsigned int flags)
Provide an XML description of the block snapshot.
virDomainBlockSnapshotXList
¶
int virDomainBlockSnapshotXList (virDomainPtr domain, virDomainBlockSnapshotXPtr ** snaps, unsigned int flags)
Collect the list of block snapshots for the domain, and allocates an array to store those objects.
snaps
to NULL in case of error. On success, the array stored into snaps
is guaranteed to have an extra allocated element set to NULL but not included in the return count to make iteration easier. The caller is responsible for calling virDomainBlockSnapshotXFree() on each array element, then calling free() on snaps
.virDomainBlockSnapshotXLookupByName
¶
virDomainBlockSnapshotXPtr virDomainBlockSnapshotXLookupByName (virDomainPtr domain, const char * name, unsigned int flags)
Look up a block snapshot by name.
virDomainBlockSnapshotXRef
¶
int virDomainBlockSnapshotXRef (virDomainBlockSnapshotXPtr snapshot)
Increment the reference count on the snapshot. For each additional call to this method, there must be a corresponding call to virDomainBlockSnapshotXFree to release the reference count once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection and domain remain open until all threads have finished using the snapshot. That is, each new thread using a snapshot will increment the reference count.