On Fri, Oct 12, 2018 at 00:10:06 -0500, Eric Blake wrote: > Prepare for introducing a bunch of new public APIs related to > backup checkpoints by first introducing a new internal type > and errors associated with that type. Checkpoints are modeled > heavily after virDomainSnapshotPtr (both represent a point in > time of the guest), although a snapshot exists with the intent > of rolling back to that state, while a checkpoint exists to > make it possible to create an incremental backup at a later > time. > > Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> > > --- > v2: fix copy-and-paste issue in virerror.c [John] > --- > include/libvirt/virterror.h | 6 +++- > src/util/virerror.c | 21 ++++++++++++- > include/libvirt/libvirt.h | 2 ++ > src/datatypes.h | 31 ++++++++++++++++++- > src/datatypes.c | 62 ++++++++++++++++++++++++++++++++++++- > src/libvirt_private.syms | 2 ++ > 6 files changed, 120 insertions(+), 4 deletions(-) > > diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h > index 57aadb8d16..65efc458a5 100644 > --- a/include/libvirt/virterror.h > +++ b/include/libvirt/virterror.h > @@ -4,7 +4,7 @@ > * Description: Provides the interfaces of the libvirt library to handle > * errors raised while using the library. > * > - * Copyright (C) 2006-2016 Red Hat, Inc. > + * Copyright (C) 2006-2018 Red Hat, Inc. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Lesser General Public > @@ -133,6 +133,7 @@ typedef enum { > VIR_FROM_PERF = 65, /* Error from perf */ > VIR_FROM_LIBSSH = 66, /* Error from libssh connection transport */ > VIR_FROM_RESCTRL = 67, /* Error from resource control */ > + VIR_FROM_DOMAIN_CHECKPOINT = 68,/* Error from domain checkpoint */ > > # ifdef VIR_ENUM_SENTINELS > VIR_ERR_DOMAIN_LAST > @@ -323,6 +324,9 @@ typedef enum { > VIR_ERR_DEVICE_MISSING = 99, /* fail to find the desired device */ > VIR_ERR_INVALID_NWFILTER_BINDING = 100, /* invalid nwfilter binding */ > VIR_ERR_NO_NWFILTER_BINDING = 101, /* no nwfilter binding */ > + VIR_ERR_INVALID_DOMAIN_CHECKPOINT = 102,/* invalid domain checkpoint */ > + VIR_ERR_NO_DOMAIN_CHECKPOINT = 103, /* domain checkpoint not found */ > + VIR_ERR_NO_DOMAIN_BACKUP = 104, /* domain backup job id not found */ > } virErrorNumber; > > /** > diff --git a/src/util/virerror.c b/src/util/virerror.c > index 683e51aa19..34a4960a73 100644 > --- a/src/util/virerror.c > +++ b/src/util/virerror.c > @@ -1,7 +1,7 @@ > /* > * virerror.c: error handling and reporting code for libvirt > * > - * Copyright (C) 2006, 2008-2016 Red Hat, Inc. > + * Copyright (C) 2006, 2008-2018 Red Hat, Inc. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Lesser General Public > @@ -136,6 +136,7 @@ VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST, > "Perf", /* 65 */ > "Libssh transport layer", > "Resource control", > + "Domain Checkpoint", > ) > > > @@ -1509,6 +1510,24 @@ virErrorMsg(virErrorNumber error, const char *info) > else > errmsg = _("Network filter binding not found: %s"); > break; > + case VIR_ERR_INVALID_DOMAIN_CHECKPOINT: > + if (info == NULL) > + errmsg = _("Invalid checkpoint"); > + else > + errmsg = _("Invalid checkpoint: %s"); > + break; > + case VIR_ERR_NO_DOMAIN_CHECKPOINT: > + if (info == NULL) > + errmsg = _("Domain checkpoint not found"); > + else > + errmsg = _("Domain checkpoint not found: %s"); > + break; > + case VIR_ERR_NO_DOMAIN_BACKUP: > + if (info == NULL) > + errmsg = _("Domain backup job id not found"); > + else > + errmsg = _("Domain backup job id not found: %s"); > + break; > } > return errmsg; All the error stuff should be in a separate commit. You don't even mention it in the commit message. > } > diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h > index 36f6d60775..26887a40e7 100644 > --- a/include/libvirt/libvirt.h > +++ b/include/libvirt/libvirt.h > @@ -36,6 +36,8 @@ extern "C" { > # include <libvirt/libvirt-common.h> > # include <libvirt/libvirt-host.h> > # include <libvirt/libvirt-domain.h> > +typedef struct _virDomainCheckpoint virDomainCheckpoint; > +typedef virDomainCheckpoint *virDomainCheckpointPtr; Ewwww. Don't mix includes with definitions. > # include <libvirt/libvirt-domain-snapshot.h> > # include <libvirt/libvirt-event.h> > # include <libvirt/libvirt-interface.h> > diff --git a/src/datatypes.h b/src/datatypes.h > index e1b38706dc..c27ac98437 100644 > --- a/src/datatypes.h > +++ b/src/datatypes.h [...] > @@ -667,6 +683,17 @@ struct _virStream { > void *privateData; > }; > > +/** > + * _virDomainCheckpoint > + * > + * Internal structure associated with a domain checkpoint > + */ > +struct _virDomainCheckpoint { > + virObject parent; > + char *name; I was thinking whether an UUID should not be used as well. But on the other hand most management tools will stash an UUID into the name anyways so it should be fine. > + virDomainPtr domain; > +}; > + > /** > * _virDomainSnapshot > * [...] > diff --git a/src/datatypes.c b/src/datatypes.c > index caf035f178..108de20b20 100644 > --- a/src/datatypes.c > +++ b/src/datatypes.c > @@ -1,7 +1,7 @@ > /* > * datatypes.c: management of structs for public data types > * > - * Copyright (C) 2006-2015 Red Hat, Inc. > + * Copyright (C) 2006-2018 Red Hat, Inc. AFAIK we established that bumping these is pointless churn. The dates can be re-establised from git history. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Lesser General Public
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list