From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yang Hongyang Subject: Re: [PATCH v2 COLOPre 07/13] tools/libxl: Update libxl__domain_unpause() to support qemu-xen Date: Mon, 15 Jun 2015 09:29:55 +0800 Message-ID: <557E2A93.6030101@cn.fujitsu.com> References: <1433734997-26570-1-git-send-email-yanghy@cn.fujitsu.com> <1433734997-26570-8-git-send-email-yanghy@cn.fujitsu.com> <20150612123346.GN14606@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150612123346.GN14606@zion.uk.xensource.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: Wei Liu Cc: ian.campbell@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@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On 06/12/2015 08:33 PM, Wei Liu wrote: > On Mon, Jun 08, 2015 at 11:43:11AM +0800, Yang Hongyang wrote: >> Currently, libxl__domain_unpause() only supports >> qemu-xen-traditional. Update it to support qemu-xen. >> >> Signed-off-by: Wen Congyang >> Signed-off-by: Yang Hongyang > > This looks very similar to an existing function called > libxl__domain_resume_device_model. Maybe you don't need to invent a new > function. > >> --- >> tools/libxl/libxl.c | 42 +++++++++++++++++++++++++++++++++--------- >> 1 file changed, 33 insertions(+), 9 deletions(-) >> >> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c >> index d5691dc..5c843c2 100644 >> --- a/tools/libxl/libxl.c >> +++ b/tools/libxl/libxl.c >> @@ -933,10 +933,37 @@ out: >> return AO_INPROGRESS; >> } >> >> -int libxl__domain_unpause(libxl__gc *gc, uint32_t domid) >> +static int libxl__domain_unpause_device_model(libxl__gc *gc, uint32_t domid) >> { >> char *path; >> char *state; >> + >> + switch (libxl__device_model_version_running(gc, domid)) { >> + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: { >> + 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")) { > > The only difference between your function and > libxl__domain_unpause_device_model is the check for "state" node. I > think you can just add the check to libxl__domain_resume_device_model > and use that function. I'm not sure if we change the existing function's behavior will affect the existing callers, if there's no problem to do so, I will do as what you said in the next version. > > Wei. > . > -- Thanks, Yang.