All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Fehlig <jfehlig@novell.com>
To: Shriram Rajagopalan <rshriram@gmail.com>
Cc: Berthold Gunreben <bg@suse.de>,
	xen-devel@lists.xensource.com,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH] xend: drbd improvements
Date: Mon, 10 Jan 2011 16:31:19 -0700	[thread overview]
Message-ID: <4D2B96C7.4050508@novell.com> (raw)
In-Reply-To: <AANLkTi=Q9SvP1DCgkTHbuB0XKc7Y_vT=V3syqdcEgizx@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]

Shriram Rajagopalan wrote:
> I was just looking over the patch on blkif.py and I believe there is a bug.
> --- a/tools/python/xen/util/blkif.py	Fri Dec 10 18:08:19 2010 +0000
> +++ b/tools/python/xen/util/blkif.py	Wed Jan 05 23:31:24 2011 +0000
> @@ -71,15 +71,8 @@ def _parse_uname(uname):
>      if uname.find(":") != -1:
>          (typ, fn) = uname.split(":", 1)
>
> -        if typ == "phy" and not fn.startswith("/"):
> +        if typ in ("phy", "drbd") and not fn.startswith("/"):
>              fn = "/dev/%s" %(fn,)
> -
> -        if typ == "drbd":
> -            if not fn.startswith("drbd"):
> -                (drbdadmstdin, drbdadmstdout) =
> os.popen2(["/sbin/drbdadm", "sh-dev", fn])
> -                fn = drbdadmstdout.readline().strip()
> -            else:
> -                fn = "/dev/%s" %(fn,)
>
>          if typ in ("tap", "tap2"):
>              (taptype, fn) = fn.split(":", 1
>
>
>  When you specify a drbd disk for a domU, its format is
>   drbd:<resourceName>
>   

Correct.  Sadly, I forgot I was testing on SLES, which contains local
xend patches to fix problems wrt external block scripts.  One of the
patches has existed for ages, before many of us were working on xen
:-).  I would really like to get these changes upstream, even though
xend is dying.  The first patch is a revert of
http://xenbits.xensource.com/xen-unstable.hg?rev/152257350930.  The
second patch, which I've rebased against -unstable, is attached.  Can
you test it?

Thanks,
Jim



[-- Attachment #2: xend-bootloader.patch --]
[-- Type: text/x-diff, Size: 3371 bytes --]

# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# Date 1294700641 25200
# Node ID c6c50a9ecd4f2f5088f63a19c2de99020bd80139
# Parent  7b4c82f07281ad9c48b652e2a305a7be607c5283
xend: improve psudeo-bootloader support for external block scripts

Userspace tools support external block scripts (e.g. block-drbd
provided by drbd project).  The psuedo-bootloader setup code in
xend has a few limitations wrt external block scripts, which this
patch addresses.

blkif.py: parse_uname() utility function should be able to parse a
disk specifier understood by the rest of the tools.

XendDomainInfo.py: Block devices using external block scripts must
be attached to dom0 before running the psuedo-bootloader.

    Signed-off-by: Jim Fehlig <jfehlig@novell.com>

diff -r 7b4c82f07281 -r c6c50a9ecd4f tools/python/xen/util/blkif.py
--- a/tools/python/xen/util/blkif.py	Wed Jan 05 23:54:15 2011 +0000
+++ b/tools/python/xen/util/blkif.py	Mon Jan 10 16:04:01 2011 -0700
@@ -66,8 +66,8 @@
                 'type'         : 'Disk' }
     return val
 
-def _parse_uname(uname):
-    fn = taptype = None
+def parse_uname(uname):
+    fn = typ = taptype = None
     if uname.find(":") != -1:
         (typ, fn) = uname.split(":", 1)
 
@@ -76,15 +76,18 @@
                
         if typ in ("tap", "tap2"):
             (taptype, fn) = fn.split(":", 1)
-    return (fn, taptype)
+            if taptype in ("tapdisk", "ioemu"):
+                (taptype, fn) = fn.split(":", 1)
+    return (fn, (typ,taptype))
+
 
 def blkdev_uname_to_file(uname):
     """Take a blkdev uname and return the corresponding filename."""
-    return _parse_uname(uname)[0]
+    return parse_uname(uname)[0]
 
 def blkdev_uname_to_taptype(uname):
     """Take a blkdev uname and return the blktap type."""
-    return _parse_uname(uname)[1]
+    return parse_uname(uname)[1]
 
 def mount_mode(name):
     mode = None
diff -r 7b4c82f07281 -r c6c50a9ecd4f tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Wed Jan 05 23:54:15 2011 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Jan 10 16:04:01 2011 -0700
@@ -38,7 +38,7 @@
 
 import xen.lowlevel.xc
 from xen.util import asserts, auxbin, mkdir
-from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype
+from xen.util.blkif import parse_uname
 import xen.util.xsm.xsm as security
 from xen.util import xsconstants
 from xen.util import mkdir
@@ -3248,9 +3248,18 @@
             devtype = devinfo[0]
             disk = devinfo[1]['uname']
 
-            fn = blkdev_uname_to_file(disk)
-            taptype = blkdev_uname_to_taptype(disk)
-            mounted = devtype in ['tap', 'tap2'] and taptype != 'aio' and taptype != 'sync' and not os.stat(fn).st_rdev
+            (fn, types) = parse_uname(disk)
+            def _shouldMount(types):
+                if types[0] in ('file', 'phy'):
+                    return False
+                if types[0] in ('tap', 'tap2'):
+                    if types[1] in ('aio', 'sync'):
+                        return False
+                    else:
+                        return True
+                return os.access('/etc/xen/scripts/block-%s' % types[0], os.X_OK)
+
+            mounted = _shouldMount(types)
             mounted_vbd_uuid = 0
             if mounted:
                 # This is a file, not a device.  pygrub can cope with a

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

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

  reply	other threads:[~2011-01-10 23:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09 17:50 [PATCH] xend: drbd improvements Jim Fehlig
2010-11-09 18:26 ` Ian Jackson
2010-11-09 22:21   ` Jim Fehlig
2010-11-10 17:49     ` Jim Fehlig
2010-12-17  0:45       ` Jim Fehlig
2010-12-17  0:58         ` Shriram Rajagopalan
2010-12-17  3:46           ` Jim Fehlig
2011-01-05 23:32         ` Ian Jackson
2011-01-06 17:48           ` Shriram Rajagopalan
2011-01-10 23:31             ` Jim Fehlig [this message]
2011-01-13  3:38               ` Jim Fehlig
2011-01-13  7:36                 ` Shriram Rajagopalan
2011-01-13 11:45                 ` Ian Jackson
2011-01-13 15:59                   ` Jim Fehlig
2011-01-18 17:24               ` Ian Jackson

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=4D2B96C7.4050508@novell.com \
    --to=jfehlig@novell.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=bg@suse.de \
    --cc=rshriram@gmail.com \
    --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.