qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, qemu-devel@nongnu.org,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [Qemu-devel] [PATCH] qemu-xen: make use of xenstore relative paths
Date: Thu, 26 Sep 2013 17:46:31 +0100	[thread overview]
Message-ID: <20130926164630.GJ6013@perard.uk.xensource.com> (raw)
In-Reply-To: <1379533858-7645-1-git-send-email-roger.pau@citrix.com>

On Wed, Sep 18, 2013 at 09:50:58PM +0200, Roger Pau Monne wrote:
> Qemu has several hardcoded xenstore paths that are only valid on Dom0.
> Attempts to launch a Qemu instance (to act as a userspace backend for
> PV disks) will fail because Qemu is not able to access those paths
> when running on a domain different than Dom0.
> 
> Instead make the xenstore paths relative to the domain where Qemu is
> actually running.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: xen-devel@lists.xenproject.org
> Cc: Anthony PERARD <anthony.perard@citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

This look fine. One issue with the patch: the file xen_backend.c have
been moved to hw/xen/xen_backend.c.

I've also tryied it in a stubdomain, and it does not boot anymore
because the qemu in the stubdom can not read the state.  I have tried
again without the change in xen-all.c, and the stubdom does not complain
anymore. So in the change in xenstore_record_dm_state() needed as well?


> ---
>  hw/xen_backend.c |   19 ++++++-------------
>  xen-all.c        |    2 +-
>  2 files changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/xen_backend.c b/hw/xen_backend.c
> index 008cdb3..e220606 100644
> --- a/hw/xen_backend.c
> +++ b/hw/xen_backend.c
> @@ -205,7 +205,6 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
>                                             struct XenDevOps *ops)
>  {
>      struct XenDevice *xendev;
> -    char *dom0;
>  
>      xendev = xen_be_find_xendev(type, dom, dev);
>      if (xendev) {
> @@ -219,12 +218,10 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
>      xendev->dev   = dev;
>      xendev->ops   = ops;
>  
> -    dom0 = xs_get_domain_path(xenstore, 0);
> -    snprintf(xendev->be, sizeof(xendev->be), "%s/backend/%s/%d/%d",
> -             dom0, xendev->type, xendev->dom, xendev->dev);
> +    snprintf(xendev->be, sizeof(xendev->be), "backend/%s/%d/%d",
> +             xendev->type, xendev->dom, xendev->dev);
>      snprintf(xendev->name, sizeof(xendev->name), "%s-%d",
>               xendev->type, xendev->dev);
> -    free(dom0);
>  
>      xendev->debug      = debug;
>      xendev->local_port = -1;
> @@ -570,14 +567,12 @@ static int xenstore_scan(const char *type, int dom, struct XenDevOps *ops)
>  {
>      struct XenDevice *xendev;
>      char path[XEN_BUFSIZE], token[XEN_BUFSIZE];
> -    char **dev = NULL, *dom0;
> +    char **dev = NULL;
>      unsigned int cdev, j;
>  
>      /* setup watch */
> -    dom0 = xs_get_domain_path(xenstore, 0);
>      snprintf(token, sizeof(token), "be:%p:%d:%p", type, dom, ops);
> -    snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);
> -    free(dom0);
> +    snprintf(path, sizeof(path), "backend/%s/%d", type, dom);
>      if (!xs_watch(xenstore, path, token)) {
>          xen_be_printf(NULL, 0, "xen be: watching backend path (%s) failed\n", path);
>          return -1;
> @@ -603,12 +598,10 @@ static void xenstore_update_be(char *watch, char *type, int dom,
>                                 struct XenDevOps *ops)
>  {
>      struct XenDevice *xendev;
> -    char path[XEN_BUFSIZE], *dom0, *bepath;
> +    char path[XEN_BUFSIZE], *bepath;
>      unsigned int len, dev;
>  
> -    dom0 = xs_get_domain_path(xenstore, 0);
> -    len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);
> -    free(dom0);
> +    len = snprintf(path, sizeof(path), "backend/%s/%d", type, dom);
>      if (strncmp(path, watch, len) != 0) {
>          return;
>      }
> diff --git a/xen-all.c b/xen-all.c
> index 15be8ed..99666f9 100644
> --- a/xen-all.c
> +++ b/xen-all.c
> @@ -967,7 +967,7 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
>          exit(1);
>      }
>  
> -    snprintf(path, sizeof (path), "/local/domain/0/device-model/%u/state", xen_domid);
> +    snprintf(path, sizeof (path), "device-model/%u/state", xen_domid);
>      if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) {
>          fprintf(stderr, "error recording dm state\n");
>          exit(1);
> -- 
> 1.7.7.5 (Apple Git-26)
> 

-- 
Anthony PERARD

  reply	other threads:[~2013-09-26 16:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-18 19:50 [Qemu-devel] [PATCH] qemu-xen: make use of xenstore relative paths Roger Pau Monne
2013-09-26 16:46 ` Anthony PERARD [this message]
2013-09-26 17:20   ` Roger Pau Monné
2013-09-27 11:01     ` Anthony PERARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130926164630.GJ6013@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=roger.pau@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).