[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 --for 4.6 COLOPre 16/25] tools/libxl: Update libxl_domain_unpause() to support qemu-xen



On Thu, 2015-07-16 at 11:49 +0800, Yang Hongyang wrote:
> 
> On 07/15/2015 08:50 PM, Ian Campbell wrote:
> > On Wed, 2015-07-15 at 15:45 +0800, Yang Hongyang wrote:
> >> Currently, libxl__domain_unpause() only supports
> >> qemu-xen-traditional. Update it to support qemu-xen.
> >> We use libxl__domain_resume_device_model to unpause guest dm.
> >>
> >> Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
> >> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> >> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> >> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> >> ---
> >>   tools/libxl/libxl.c | 15 +++++----------
> >>   1 file changed, 5 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> >> index 5b2d045..799aead 100644
> >> --- a/tools/libxl/libxl.c
> >> +++ b/tools/libxl/libxl.c
> >> @@ -941,8 +941,6 @@ out:
> >>   int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid)
> >>   {
> >>       GC_INIT(ctx);
> >> -    char *path;
> >> -    char *state;
> >>       int ret, rc = 0;
> >>
> >>       libxl_domain_type type = libxl__domain_type(gc, domid);
> >> @@ -952,14 +950,11 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t 
> >> domid)
> >>       }
> >>
> >>       if (type == LIBXL_DOMAIN_TYPE_HVM) {
> >> -        uint32_t dm_domid = libxl_get_stubdom_id(ctx, domid);
> >> -
> >> -        path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
> >> -        state = libxl__xs_read(gc, XBT_NULL, path);
> >> -        if (state != NULL && !strcmp(state, "paused")) {
> >> -            libxl__qemu_traditional_cmd(gc, domid, "continue");
> >> -            libxl__wait_for_device_model_deprecated(gc, domid, "running",
> >> -                                         NULL, NULL, NULL);
> >> +        rc = libxl__domain_resume_device_model(gc, domid);
> >> +        if (rc < 0) {
> >> +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "failed to unpause device 
> >> model "
> >> +                       "for domain %u:%d", domid, rc);
> >
> > Please use the preferred form of LOG(ERROR, "failed to..."), which
> > should also hopefully allow you to avoid splitting the line in the
> > middle of a string constant which is discouraged.
> >
> > If you can't use LOG() then please:
> >              LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
> >                         "failed to unpause device model for domain %u:%d",
> >                          domid, rc);
> >
> > Not splitting string constants means you can grep for an error message.
> 
> Sorry, the commit message is wrong, it's libxl_domain_unpause, not
> libxl__domain_unpause, LOG() can't be used, so I will update commit message
> and use your later suggestion, thank you!

Why can't LOG() be used? libxl_domain_unpause has a GC_INIT(ctx), so you
should have a gc in scope, which is all you need.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.