From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yang Hongyang Subject: Re: [PATCH v4 --for 4.6 COLOPre 16/25] tools/libxl: Update libxl_domain_unpause() to support qemu-xen Date: Thu, 16 Jul 2015 18:51:45 +0800 Message-ID: <55A78CC1.9020502@cn.fujitsu.com> References: <1436946351-21118-1-git-send-email-yanghy@cn.fujitsu.com> <1436946351-21118-17-git-send-email-yanghy@cn.fujitsu.com> <1436964647.32371.46.camel@citrix.com> <55A729E3.5020800@cn.fujitsu.com> <1437043179.32371.162.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1437043179.32371.162.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: wei.liu2@citrix.com, wency@cn.fujitsu.com, andrew.cooper3@citrix.com, yunhong.jiang@intel.com, eddie.dong@intel.com, xen-devel@lists.xen.org, guijianfeng@cn.fujitsu.com, rshriram@cs.ubc.ca, Ian Jackson List-Id: xen-devel@lists.xenproject.org On 07/16/2015 06:39 PM, Ian Campbell wrote: > 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 >>>> CC: Ian Campbell >>>> CC: Ian Jackson >>>> CC: Wei Liu >>>> --- >>>> 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. Sorry, my memory is wrong, fixed now. > > Ian. > > . > -- Thanks, Yang.