1 /* 2 * qemu_snapshot.h: Implementation and handling of snapshots 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library. If not, see 16 * <http://www.gnu.org/licenses/>. 17 */ 18 19 #pragma once 20 21 #include "virconftypes.h" 22 #include "datatypes.h" 23 #include "qemu_conf.h" 24 #include "qemu_domainjob.h" 25 26 virDomainMomentObj * 27 qemuSnapObjFromName(virDomainObj *vm, 28 const char *name); 29 30 virDomainMomentObj * 31 qemuSnapObjFromSnapshot(virDomainObj *vm, 32 virDomainSnapshotPtr snapshot); 33 34 int 35 qemuSnapshotFSFreeze(virDomainObj *vm, 36 const char **mountpoints, 37 unsigned int nmountpoints); 38 int 39 qemuSnapshotFSThaw(virDomainObj *vm, 40 bool report); 41 42 virDomainSnapshotPtr 43 qemuSnapshotCreateXML(virDomainPtr domain, 44 virDomainObj *vm, 45 const char *xmlDesc, 46 unsigned int flags); 47 48 int 49 qemuSnapshotRevert(virDomainObj *vm, 50 virDomainSnapshotPtr snapshot, 51 unsigned int flags); 52 53 int 54 qemuSnapshotDelete(virDomainObj *vm, 55 virDomainSnapshotPtr snapshot, 56 unsigned int flags); 57 58 59 typedef struct _qemuSnapshotDiskContext qemuSnapshotDiskContext; 60 61 qemuSnapshotDiskContext * 62 qemuSnapshotDiskContextNew(size_t ndisks, 63 virDomainObj *vm, 64 qemuDomainAsyncJob asyncJob); 65 66 void 67 qemuSnapshotDiskContextCleanup(qemuSnapshotDiskContext *snapctxt); 68 69 G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuSnapshotDiskContext, qemuSnapshotDiskContextCleanup); 70 71 int 72 qemuSnapshotDiskPrepareOne(qemuSnapshotDiskContext *snapctxt, 73 virDomainDiskDef *disk, 74 virDomainSnapshotDiskDef *snapdisk, 75 GHashTable *blockNamedNodeData, 76 bool reuse, 77 bool updateConfig); 78 int 79 qemuSnapshotDiskCreate(qemuSnapshotDiskContext *snapctxt); 80 81 virDomainSnapshotDiskDef * 82 qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk, 83 const char *suffix); 84