[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 6/9] libxl: add libxl__domain_soft_reset_destroy_old()
On Wed, Dec 03, 2014 at 06:16:18PM +0100, Vitaly Kuznetsov wrote: > New libxl__domain_soft_reset_destroy_old() is an internal-only > version of libxl_domain_destroy() which follows the same domain > destroy path with the only difference: xc_domain_destroy() is > being avoided so the domain is not actually being destroyed. > > Add soft_reset flag to libxl__domain_destroy_state structure > to support the change. > > The original libxl_domain_destroy() function could be easily > modified to support new flag but I'm trying to avoid that as > it is part of public API. > > Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> > --- > tools/libxl/libxl.c | 32 +++++++++++++++++++++++++++----- > tools/libxl/libxl_internal.h | 4 ++++ > 2 files changed, 31 insertions(+), 5 deletions(-) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index f84f7c2..c2bd730 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -1437,6 +1437,23 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t > domid, > return AO_INPROGRESS; > } > > +int libxl__domain_soft_reset_destroy_old(libxl_ctx *ctx, uint32_t domid, > + const libxl_asyncop_how *ao_how) > +{ Internal function takes gc, not ctx. > + AO_CREATE(ctx, domid, ao_how); If you want to use libxl context, use CTX macro. > + libxl__domain_destroy_state *dds; > + > + GCNEW(dds); > + dds->ao = ao; > + dds->domid = domid; > + dds->callback = domain_destroy_cb; > + dds->soft_reset = 1; > + libxl__domain_destroy(egc, dds); > + > + return AO_INPROGRESS; > +} > + > + > static void domain_destroy_cb(libxl__egc *egc, libxl__domain_destroy_state > *dds, > int rc) > { > @@ -1612,6 +1629,7 @@ static void devices_destroy_cb(libxl__egc *egc, > { > STATE_AO_GC(drs->ao); > libxl__destroy_domid_state *dis = CONTAINER_OF(drs, *dis, drs); > + libxl__domain_destroy_state *dds = CONTAINER_OF(dis, *dds, domain); > libxl_ctx *ctx = CTX; > uint32_t domid = dis->domid; > char *dom_path; > @@ -1650,11 +1668,15 @@ static void devices_destroy_cb(libxl__egc *egc, > } > libxl__userdata_destroyall(gc, domid); > > - rc = xc_domain_destroy(ctx->xch, domid); > - if (rc < 0) { > - LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_destroy > failed for %d", domid); > - rc = ERROR_FAIL; > - goto out; > + if (!dds->soft_reset) > + { Coding style. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |