2019-03-15 02:19:18 +00:00
|
|
|
/*
|
|
|
|
* virdomainsnapshotobjlist.h: handle a tree of snapshot objects
|
|
|
|
* (derived from snapshot_conf.h)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006-2019 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#pragma once
|
2019-03-15 02:19:18 +00:00
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virdomainmomentobjlist.h"
|
|
|
|
#include "virbuffer.h"
|
2019-03-15 02:19:18 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virDomainSnapshotObjList *virDomainSnapshotObjListNew(void);
|
|
|
|
void virDomainSnapshotObjListFree(virDomainSnapshotObjList *snapshots);
|
2019-03-15 02:19:18 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virDomainMomentObj *virDomainSnapshotAssignDef(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainSnapshotDef *def);
|
2019-03-15 02:19:18 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virDomainSnapshotObjListGetNames(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainMomentObj *from,
|
2019-03-15 02:19:18 +00:00
|
|
|
char **const names, int maxnames,
|
|
|
|
unsigned int flags);
|
2021-03-11 07:16:13 +00:00
|
|
|
int virDomainSnapshotObjListNum(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainMomentObj *from,
|
2019-03-15 02:19:18 +00:00
|
|
|
unsigned int flags);
|
2021-03-11 07:16:13 +00:00
|
|
|
virDomainMomentObj *virDomainSnapshotFindByName(virDomainSnapshotObjList *snapshots,
|
2019-03-22 04:45:25 +00:00
|
|
|
const char *name);
|
2021-03-11 07:16:13 +00:00
|
|
|
virDomainMomentObj *virDomainSnapshotGetCurrent(virDomainSnapshotObjList *snapshots);
|
|
|
|
const char *virDomainSnapshotGetCurrentName(virDomainSnapshotObjList *snapshots);
|
|
|
|
void virDomainSnapshotSetCurrent(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainMomentObj *snapshot);
|
|
|
|
bool virDomainSnapshotObjListRemove(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainMomentObj *snapshot);
|
|
|
|
void virDomainSnapshotObjListRemoveAll(virDomainSnapshotObjList *snapshots);
|
|
|
|
int virDomainSnapshotForEach(virDomainSnapshotObjList *snapshots,
|
2019-03-15 02:19:18 +00:00
|
|
|
virHashIterator iter,
|
|
|
|
void *data);
|
2021-03-11 07:16:13 +00:00
|
|
|
void virDomainSnapshotLinkParent(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainMomentObj *moment);
|
|
|
|
int virDomainSnapshotUpdateRelations(virDomainSnapshotObjList *snapshots);
|
|
|
|
int virDomainSnapshotCheckCycles(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainSnapshotDef *def,
|
2019-07-06 02:07:43 +00:00
|
|
|
const char *domname);
|
2019-03-15 02:19:18 +00:00
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA \
|
2019-03-20 02:33:23 +00:00
|
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_METADATA | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES \
|
2019-03-20 02:33:23 +00:00
|
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_LEAVES | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS \
|
2019-03-20 02:33:23 +00:00
|
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION \
|
2019-03-20 02:33:23 +00:00
|
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_DOMAIN_SNAPSHOT_FILTERS_ALL \
|
2019-03-20 02:33:23 +00:00
|
|
|
(VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS | \
|
|
|
|
VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION)
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virDomainListSnapshots(virDomainSnapshotObjList *snapshots,
|
|
|
|
virDomainMomentObj *from,
|
2019-03-15 02:19:18 +00:00
|
|
|
virDomainPtr dom,
|
|
|
|
virDomainSnapshotPtr **snaps,
|
|
|
|
unsigned int flags);
|
|
|
|
|
2019-03-18 21:13:50 +00:00
|
|
|
/* Access the snapshot-specific definition from a given list member. */
|
2021-03-11 07:16:13 +00:00
|
|
|
static inline virDomainSnapshotDef *
|
|
|
|
virDomainSnapshotObjGetDef(virDomainMomentObj *obj)
|
2019-03-18 21:13:50 +00:00
|
|
|
{
|
2021-03-11 07:16:13 +00:00
|
|
|
return (virDomainSnapshotDef *) obj->def;
|
2019-03-18 21:13:50 +00:00
|
|
|
}
|