From patchwork Tue Dec 22 18:44:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 7906741 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4DADEBF0A9 for ; Tue, 22 Dec 2015 18:48:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D2BA20567 for ; Tue, 22 Dec 2015 18:48:17 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D01FA20561 for ; Tue, 22 Dec 2015 18:48:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aBRwn-0002E3-EQ; Tue, 22 Dec 2015 18:46:09 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aBRwa-0001ny-VH for xen-devel@lists.xensource.com; Tue, 22 Dec 2015 18:45:57 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id C2/E1-24856-46A99765; Tue, 22 Dec 2015 18:45:56 +0000 X-Env-Sender: prvs=791371759=Ian.Jackson@citrix.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1450809952!12310273!4 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43990 invoked from network); 22 Dec 2015 18:45:55 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 22 Dec 2015 18:45:55 -0000 X-IronPort-AV: E=Sophos;i="5.20,465,1444694400"; d="scan'208";a="327002749" From: Ian Jackson To: Date: Tue, 22 Dec 2015 18:44:53 +0000 Message-ID: <1450809903-3393-19-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1450809903-3393-1-git-send-email-ian.jackson@eu.citrix.com> References: <1450809903-3393-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Jackson , Wei Liu , Ian Campbell , Stefano Stabellini Subject: [Xen-devel] [PATCH 18/28] libxl: emuids: Change pid path in xenstore X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce libxl__dm_xs_pid_path and use it everywhere. There is no overall functional change, although there is a change to these internal paths. Also, the paths used are now relative (ie to /local/domain/) rather than absolute. Signed-off-by: Stefano Stabellini Signed-off-by: Ian Jackson --- v6: Rewritten, actual paths changed, patch title changed v4: Update xenstore-paths.markdown --- docs/misc/xenstore-paths.markdown | 10 +++------- tools/libxl/libxl_dm.c | 11 +++++------ tools/libxl/libxl_internal.c | 6 ++++++ tools/libxl/libxl_internal.h | 3 +++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/misc/xenstore-paths.markdown b/docs/misc/xenstore-paths.markdown index 208b64b..3bd31af 100644 --- a/docs/misc/xenstore-paths.markdown +++ b/docs/misc/xenstore-paths.markdown @@ -143,11 +143,6 @@ The guests name. The domain's own ID. -#### ~/image/device-model-pid = INTEGER [INTERNAL] - -The process ID of the device model associated with this domain, if it -has one. - #### ~/cpu/[0-9]+/availability = ("online"|"offline") [PV] One node for each virtual CPU up to the guest's configured @@ -463,9 +458,10 @@ in the value supplied by the guest in this case). Contains the status of the device models running on the domain. -#### ~/libxl/$DOMID/qdisk-backend-pid [w] +#### ~/libxl/$DOMID/dm-pid-$EMUID [w] = INTEGER [INTERNAL] -Contains the PIDs of the device models running on the domain. +Contains the PIDs of the device models running on this domain, to +service $DOMID. ## Virtual Machine Paths diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 3bf1317..6b0bbed 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1867,7 +1867,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss, } const char *dom_path = libxl__xs_get_dompath(gc, domid); - spawn->pidpath = GCSPRINTF("%s/%s", dom_path, "image/device-model-pid"); + spawn->pidpath = libxl__dm_xs_pid_path(gc, domid, emuid); if (vnc && vnc->passwd) { /* This xenstore key will only be used by qemu-xen-traditionnal. @@ -1901,7 +1901,7 @@ retry_transaction: spawn->xspath = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID, domid, emuid, "/state"); spawn->timeout_ms = LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000; - spawn->pidpath = GCSPRINTF("%s/image/device-model-pid", dom_path); + spawn->pidpath = libxl__dm_xs_pid_path(gc, domid, emuid); spawn->midproc_cb = libxl__spawn_record_pid; spawn->confirm_cb = device_model_confirm; spawn->failure_cb = device_model_startup_failed; @@ -2036,7 +2036,7 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss) * because we will call this from unprivileged driver domains, * so save it in the current domain libxl private dir. */ - dmss->spawn.pidpath = GCSPRINTF("libxl/%u/qdisk-backend-pid", domid); + dmss->spawn.pidpath = libxl__dm_xs_pid_path(gc, domid, EMUID_PV); dmss->spawn.midproc_cb = libxl__spawn_record_pid; dmss->spawn.confirm_cb = device_model_confirm; dmss->spawn.failure_cb = device_model_startup_failed; @@ -2101,7 +2101,7 @@ int libxl__destroy_qdisk_backend(libxl__gc *gc, uint32_t domid) char *pid_path; int rc; - pid_path = GCSPRINTF("libxl/%u/qdisk-backend-pid", domid); + pid_path = libxl__dm_xs_pid_path(gc, domid, EMUID_PV); rc = kill_device_model(gc, pid_path); if (rc) @@ -2129,8 +2129,7 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid, LOG(ERROR, "xs_rm failed for %s", path); /* We should try to destroy the device model anyway. */ - rc = kill_device_model(gc, - GCSPRINTF("/local/domain/%d/image/device-model-pid", domid)); + rc = kill_device_model(gc, libxl__dm_xs_pid_path(gc, domid, emuid)); if (rc) LOG(ERROR, "libxl__destroy_device_model failed for %d (emuid=%d)", domid, emuid); diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index d0c98b0..30271c9 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -576,6 +576,12 @@ char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid, return s; } +char *libxl__dm_xs_pid_path(libxl__gc *gc, int guest_domid, int emuid) +{ + return GCSPRINTF("libxl/%d/dm-pid-%d", guest_domid, emuid); +} + + /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 2248509..350ec29 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1986,6 +1986,9 @@ _hidden char *libxl__dm_xs_path_rel(libxl__gc *gc, uint32_t domid, int emuid); /* returns relative path (ie assuming we are the toolstack) */ +_hidden char *libxl__dm_xs_pid_path(libxl__gc *gc, + int guest_domid, int emuid); + /* * Calling context and GC for event-generating functions: *