All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shriram Rajagopalan <rshriram@gmail.com>
To: James Harper <james.harper@bendigoit.com.au>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] make qemu handle drbd properly
Date: Sat, 25 Jun 2011 12:47:09 -0400	[thread overview]
Message-ID: <BANLkTind3O2QvpLE4VN08SBBOMvdZe7QwA@mail.gmail.com> (raw)
In-Reply-To: <AEC6C66638C05B468B556EA548C1A77D01BB92B8@trantor>


[-- Attachment #1.1: Type: text/plain, Size: 2733 bytes --]

On Wed, Jan 26, 2011 at 11:43 PM, James Harper <
james.harper@bendigoit.com.au> wrote:

> This attached patch allows qemu to accept a drbd: prefix and interpret
> it as a drbd resource. It then searches for it in /dev/drbd/by-res/
> (which must be mapped via udev). It's against 4.0-testing.
>
> Also, the block scripts make the drbd resource primary but don't want
> for it to actually become available. A secondary drbd resource returns
> EMEDIUMTYPE so if we get that result, wait half a second and retry, up
> to a total of 5 retries. Fixing this in the block scripts might be
> better but I can't see how to do it cleanly.
>
> James
>
>
> diff --git a/xenstore.c b/xenstore.c
> index 13b8d57..f6e2170 100644
> --- a/xenstore.c
> +++ b/xenstore.c
> @@ -413,6 +413,9 @@ void xenstore_parse_domain_config(int hvm_domid)
>     char *danger_buf = NULL;
>     char *danger_type = NULL;
>
> +    int retries = 1; /* number of attempts to open the block device -
> drbd can take a second to become available */
> +    int status;
> +
>     for(i = 0; i < MAX_DRIVES + 1; i++)
>         media_filename[i] = NULL;
>
> @@ -519,6 +522,14 @@ void xenstore_parse_domain_config(int hvm_domid)
>            format = &bdrv_raw;
>         }
>
> +        if (!strcmp(drv, "drbd")) {
> +            char *newparams = malloc(17 + strlen(params) + 1);
> +            sprintf(newparams, "/dev/drbd/by-res/%s", params);
> +            free(params);
> +            params = newparams;
> +           format = &bdrv_raw;
> +            retries = 5;
> +        }
>  #if 0
>        /* Phantom VBDs are disabled because the use of paths
>         * from guest-controlled areas in xenstore is unsafe.
> @@ -617,7 +628,14 @@ void xenstore_parse_domain_config(int hvm_domid)
>
>             fprintf(stderr, "Using file %s in read-%s mode\n",
> bs->filename, is_readonly ? "only" : "write");
>
> -            if (bdrv_open2(bs, params, flags, format) < 0)
> +            do {
> +                int status = bdrv_open2(bs, params, flags, format);
> +                if (status != -EMEDIUMTYPE)
> +                    break;
> +                usleep(500000); /* 500ms */
> +                retries--;
> +            } while (retries);
> +            if (status < 0)
>                 fprintf(stderr, "qemu: could not open vbd '%s' or hard
> disk image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?",
> format ? format->format_name : "
>         }
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>

Sorry to dig up an old thread. This patch doesnt seem to be in any of the
qemu-xen-*, xen-*-testing or xen-unstable trees. Any reason why?

shriram

[-- Attachment #1.2: Type: text/html, Size: 3467 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2011-06-25 16:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Acu93M69hrwjXAfcQG+0NjGopOq6NQ==>
2011-01-27  4:43 ` [PATCH] make qemu handle drbd properly James Harper
2011-01-27 19:47   ` Ian Jackson
2011-01-28 15:39     ` Jim Fehlig
2011-01-28 17:33       ` Ian Jackson
2011-06-25 16:47   ` Shriram Rajagopalan [this message]
2011-06-28 12:54     ` Ian Jackson
2011-08-30  4:11       ` Shriram Rajagopalan
2011-08-30  4:40         ` James Harper
2011-08-30 10:36           ` Stefano Stabellini
2011-08-30 12:46             ` James Harper
2011-08-30 14:37               ` Stefano Stabellini

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=BANLkTind3O2QvpLE4VN08SBBOMvdZe7QwA@mail.gmail.com \
    --to=rshriram@gmail.com \
    --cc=james.harper@bendigoit.com.au \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.