提交 6c8adeb4 编写于 作者: G Geoff Hickey 提交者: Eric Blake

esx: Support for disk-only and quiescing snapshots.

Add support for creating disk-only (no memory) snapshots in esx, and
for quiescing the VM before taking the snapshot. The VMware API
supports these operations directly, so adding support to libvirt is
just a matter of setting the flags correctly when calling
VMware. VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY and
VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE are now valid flags for esx.
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 261c4f5f
...@@ -4209,9 +4209,14 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc, ...@@ -4209,9 +4209,14 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
esxVI_TaskInfoState taskInfoState; esxVI_TaskInfoState taskInfoState;
char *taskInfoErrorMessage = NULL; char *taskInfoErrorMessage = NULL;
virDomainSnapshotPtr snapshot = NULL; virDomainSnapshotPtr snapshot = NULL;
bool diskOnly = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) != 0;
bool quiesce = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) != 0;
/* ESX has no snapshot metadata, so this flag is trivial. */ /* ESX supports disk-only and quiesced snapshots; libvirt tracks no
virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, NULL); * snapshot metadata so supporting that flag is trivial. */
virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY |
VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE |
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, NULL);
if (esxVI_EnsureSession(priv->primary) < 0) { if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL; return NULL;
...@@ -4249,8 +4254,9 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc, ...@@ -4249,8 +4254,9 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
if (esxVI_CreateSnapshot_Task(priv->primary, virtualMachine->obj, if (esxVI_CreateSnapshot_Task(priv->primary, virtualMachine->obj,
def->name, def->description, def->name, def->description,
esxVI_Boolean_True, diskOnly ? esxVI_Boolean_False : esxVI_Boolean_True,
esxVI_Boolean_False, &task) < 0 || quiesce ? esxVI_Boolean_True : esxVI_Boolean_False,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid, esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
esxVI_Occurrence_RequiredItem, esxVI_Occurrence_RequiredItem,
priv->parsedUri->autoAnswer, &taskInfoState, priv->parsedUri->autoAnswer, &taskInfoState,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册