mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
snapshot: Rename file for virDomainMomentObj
Now that we have made virDomainMomentObj sufficiently generic to support both snapshots and checkpoints, it is time to rename the file that it lives in. The split between a generic object and a list of the generic objects doesn't buy us as much, so it will be easier to stick all the moment list code in one file, with more code moving in the next patch. The changes during the move are fairly minor, although it is worth pointing out that the log/error messages for the new file report that they are from "domain", since the file will eventually be shared by both "domain snapshot" and "domain checkpoint". Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
e055a816af
commit
5d23cd1c52
@ -31,8 +31,8 @@ DOMAIN_CONF_SOURCES = \
|
|||||||
conf/virconftypes.h \
|
conf/virconftypes.h \
|
||||||
conf/virdomainobjlist.c \
|
conf/virdomainobjlist.c \
|
||||||
conf/virdomainobjlist.h \
|
conf/virdomainobjlist.h \
|
||||||
conf/virdomainsnapshotobj.c \
|
conf/virdomainmomentobjlist.c \
|
||||||
conf/virdomainsnapshotobj.h \
|
conf/virdomainmomentobjlist.h \
|
||||||
conf/virdomainsnapshotobjlist.c \
|
conf/virdomainsnapshotobjlist.c \
|
||||||
conf/virdomainsnapshotobjlist.h \
|
conf/virdomainsnapshotobjlist.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* virdomainsnapshotobj.c: handle snapshot objects
|
* virdomainmomentobjlist.c: handle snapshot/checkpoint objects
|
||||||
* (derived from snapshot_conf.c)
|
* (derived from snapshot_conf.c)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2019 Red Hat, Inc.
|
* Copyright (C) 2006-2019 Red Hat, Inc.
|
||||||
@ -23,15 +23,15 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "virdomainsnapshotobj.h"
|
#include "virdomainmomentobjlist.h"
|
||||||
#include "snapshot_conf.h"
|
|
||||||
#include "virdomainsnapshotobjlist.h"
|
|
||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
|
#include "virstring.h"
|
||||||
|
#include "moment_conf.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_DOMAIN_SNAPSHOT
|
#define VIR_FROM_THIS VIR_FROM_DOMAIN
|
||||||
|
|
||||||
VIR_LOG_INIT("conf.virdomainsnapshotobj");
|
VIR_LOG_INIT("conf.virdomainmomentobjlist");
|
||||||
|
|
||||||
/* Run iter(data) on all direct children of moment, while ignoring all
|
/* Run iter(data) on all direct children of moment, while ignoring all
|
||||||
* other entries in moments. Return the number of children
|
* other entries in moments. Return the number of children
|
||||||
@ -68,8 +68,8 @@ virDomainMomentActOnDescendant(void *payload,
|
|||||||
|
|
||||||
(curr->iter)(payload, name, curr->data);
|
(curr->iter)(payload, name, curr->data);
|
||||||
curr->number += 1 + virDomainMomentForEachDescendant(obj,
|
curr->number += 1 + virDomainMomentForEachDescendant(obj,
|
||||||
curr->iter,
|
curr->iter,
|
||||||
curr->data);
|
curr->data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ virDomainMomentDropParent(virDomainMomentObjPtr moment)
|
|||||||
curr = moment->parent->first_child;
|
curr = moment->parent->first_child;
|
||||||
while (curr != moment) {
|
while (curr != moment) {
|
||||||
if (!curr) {
|
if (!curr) {
|
||||||
VIR_WARN("inconsistent snapshot relations");
|
VIR_WARN("inconsistent moment relations");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prev = curr;
|
prev = curr;
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* virdomainsnapshotobj.h: handle snapshot objects
|
* virdomainmomentobjlist.h: handle a tree of moment objects
|
||||||
* (derived from snapshot_conf.h)
|
* (derived from snapshot_conf.h)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2019 Red Hat, Inc.
|
* Copyright (C) 2006-2019 Red Hat, Inc.
|
||||||
@ -20,25 +20,33 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H
|
#ifndef LIBVIRT_VIRDOMAINMOMENTOBJLIST_H
|
||||||
# define LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H
|
# define LIBVIRT_VIRDOMAINMOMENTOBJLIST_H
|
||||||
|
|
||||||
# include "internal.h"
|
# include "internal.h"
|
||||||
# include "virconftypes.h"
|
# include "virconftypes.h"
|
||||||
# include "virhash.h"
|
# include "virhash.h"
|
||||||
|
|
||||||
|
/* Struct that allows tracing hierarchical relationships between
|
||||||
|
* multiple virDomainMoment objects. The opaque type
|
||||||
|
* virDomainMomentObjList then maintains both a hash of these structs
|
||||||
|
* (for quick lookup by name) and a metaroot (which is the parent of
|
||||||
|
* all user-visible roots), so that all other objects always have a
|
||||||
|
* valid parent object; the tree structure is currently maintained via
|
||||||
|
* a linked list. */
|
||||||
struct _virDomainMomentObj {
|
struct _virDomainMomentObj {
|
||||||
|
/* Public field */
|
||||||
virDomainMomentDefPtr def; /* non-NULL except for metaroot */
|
virDomainMomentDefPtr def; /* non-NULL except for metaroot */
|
||||||
|
|
||||||
|
/* Private fields, use accessors instead */
|
||||||
virDomainMomentObjPtr parent; /* non-NULL except for metaroot, before
|
virDomainMomentObjPtr parent; /* non-NULL except for metaroot, before
|
||||||
virDomainSnapshotUpdateRelations, or
|
virDomainMomentUpdateRelations, or
|
||||||
after virDomainMomentDropParent */
|
after virDomainMomentDropParent */
|
||||||
virDomainMomentObjPtr sibling; /* NULL if last child of parent */
|
virDomainMomentObjPtr sibling; /* NULL if last child of parent */
|
||||||
size_t nchildren;
|
size_t nchildren;
|
||||||
virDomainMomentObjPtr first_child; /* NULL if no children */
|
virDomainMomentObjPtr first_child; /* NULL if no children */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int virDomainMomentForEachChild(virDomainMomentObjPtr moment,
|
int virDomainMomentForEachChild(virDomainMomentObjPtr moment,
|
||||||
virHashIterator iter,
|
virHashIterator iter,
|
||||||
void *data);
|
void *data);
|
||||||
@ -52,4 +60,4 @@ void virDomainMomentMoveChildren(virDomainMomentObjPtr from,
|
|||||||
void virDomainMomentSetParent(virDomainMomentObjPtr moment,
|
void virDomainMomentSetParent(virDomainMomentObjPtr moment,
|
||||||
virDomainMomentObjPtr parent);
|
virDomainMomentObjPtr parent);
|
||||||
|
|
||||||
#endif /* LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H */
|
#endif /* LIBVIRT_VIRDOMAINMOMENTOBJLIST_H */
|
@ -24,7 +24,7 @@
|
|||||||
# define LIBVIRT_VIRDOMAINSNAPSHOTOBJLIST_H
|
# define LIBVIRT_VIRDOMAINSNAPSHOTOBJLIST_H
|
||||||
|
|
||||||
# include "internal.h"
|
# include "internal.h"
|
||||||
# include "virdomainsnapshotobj.h"
|
# include "virdomainmomentobjlist.h"
|
||||||
# include "virbuffer.h"
|
# include "virbuffer.h"
|
||||||
|
|
||||||
/* Filter that returns true if a given moment matches the filter flags */
|
/* Filter that returns true if a given moment matches the filter flags */
|
||||||
|
@ -960,6 +960,15 @@ virChrdevFree;
|
|||||||
virChrdevOpen;
|
virChrdevOpen;
|
||||||
|
|
||||||
|
|
||||||
|
# conf/virdomainmomentobjlist.h
|
||||||
|
virDomainMomentDropChildren;
|
||||||
|
virDomainMomentDropParent;
|
||||||
|
virDomainMomentForEachChild;
|
||||||
|
virDomainMomentForEachDescendant;
|
||||||
|
virDomainMomentMoveChildren;
|
||||||
|
virDomainMomentSetParent;
|
||||||
|
|
||||||
|
|
||||||
# conf/virdomainobjlist.h
|
# conf/virdomainobjlist.h
|
||||||
virDomainObjListAdd;
|
virDomainObjListAdd;
|
||||||
virDomainObjListCollect;
|
virDomainObjListCollect;
|
||||||
@ -979,15 +988,6 @@ virDomainObjListRemoveLocked;
|
|||||||
virDomainObjListRename;
|
virDomainObjListRename;
|
||||||
|
|
||||||
|
|
||||||
# conf/virdomainsnapshotobj.h
|
|
||||||
virDomainMomentDropChildren;
|
|
||||||
virDomainMomentDropParent;
|
|
||||||
virDomainMomentForEachChild;
|
|
||||||
virDomainMomentForEachDescendant;
|
|
||||||
virDomainMomentMoveChildren;
|
|
||||||
virDomainMomentSetParent;
|
|
||||||
|
|
||||||
|
|
||||||
# conf/virdomainsnapshotobjlist.h
|
# conf/virdomainsnapshotobjlist.h
|
||||||
virDomainListSnapshots;
|
virDomainListSnapshots;
|
||||||
virDomainSnapshotAssignDef;
|
virDomainSnapshotAssignDef;
|
||||||
|
Loading…
Reference in New Issue
Block a user