提交 27054e12 编写于 作者: P Peter Krempa

qemu: Don't return success if creation of snapshot save file fails

When the snapshot definition can't be saved, the
qemuDomainSnapshotCreate function succeeded without filling some of the
fields in the internal definition.

This patch removes the snapshot and returns failure if the XML file
cannot be written.
上级 31bee857
......@@ -11598,8 +11598,14 @@ cleanup:
if (snapshot && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) {
if (qemuDomainSnapshotWriteMetadata(vm, snap,
driver->snapshotDir) < 0) {
VIR_WARN("unable to save metadata for snapshot %s",
snap->def->name);
/* if writing of metadata fails, error out rather than trying
* to silently carry on without completing the snapshot */
virDomainSnapshotFree(snapshot);
snapshot = NULL;
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to save metadata for snapshot %s"),
snap->def->name);
virDomainSnapshotObjListRemove(vm->snapshots, snap);
} else {
if (update_current)
vm->current_snapshot = snap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册