libvirt/src/qemu/qemu_snapshot.h
Peter Krempa 117ff49db7 qemu: snapshot: Introduce helpers for creating overlays on <transient/> disks
To implement <transient/> disks we'll need to install an overlay on top
of the original disk image which will be discarded after the VM is
turned off. This was initially implemented by qemu but libvirt never
picked up this option as the overlays were created by qemu without
libvirt involvment which didn't work with SELinux.

With blockdev the qemu feature became unsupported so we need to do this
via the snapshot code anyways.

The helpers introduced in this patch prepare a fake snapshot disk
definition for a disk which is configured as <transient/> and use it to
create a snapshot (without actually modifying metadata or persistent
def).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
2020-10-01 09:55:02 +02:00

61 lines
1.8 KiB
C

/*
* qemu_snapshot.h: Implementation and handling of snapshots
*
* 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/>.
*/
#pragma once
#include "virconftypes.h"
#include "datatypes.h"
#include "qemu_conf.h"
#include "qemu_domainjob.h"
virDomainMomentObjPtr
qemuSnapObjFromName(virDomainObjPtr vm,
const char *name);
virDomainMomentObjPtr
qemuSnapObjFromSnapshot(virDomainObjPtr vm,
virDomainSnapshotPtr snapshot);
int
qemuSnapshotFSFreeze(virDomainObjPtr vm,
const char **mountpoints,
unsigned int nmountpoints);
int
qemuSnapshotFSThaw(virDomainObjPtr vm,
bool report);
virDomainSnapshotPtr
qemuSnapshotCreateXML(virDomainPtr domain,
virDomainObjPtr vm,
const char *xmlDesc,
unsigned int flags);
int
qemuSnapshotRevert(virDomainObjPtr vm,
virDomainSnapshotPtr snapshot,
unsigned int flags);
int
qemuSnapshotDelete(virDomainObjPtr vm,
virDomainSnapshotPtr snapshot,
unsigned int flags);
int
qemuSnapshotCreateDisksTransient(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob);