/bugzilla3/ Bug 1438 – Cannot use pygrub with drbd blcok device as xvda.
Bug 1438 - Cannot use pygrub with drbd blcok device as xvda.
: Cannot use pygrub with drbd blcok device as xvda.
Status: NEW
Product: Xen
Tools
: 3.0.4
: All Linux
: P2 normal
Assigned To: Xen Bug List
: http://ben.timby.com/?p=80
:
:
  Show dependency treegraph
 
Reported: 2009-03-25 13:55 CDT by ben timby
Modified: 2011-06-24 18:46 CDT (History)
0 users (show)

See Also:


Attachments
Fixes the issue. (551 bytes, patch)
2009-03-25 13:55 CDT, ben timby
Details
Patch for pygrub for disk = [ "drbd:resname,xvda,w" ] syntax (1.56 KB, patch)
2009-09-24 07:09 CDT, Andrey Zentavr
Details
Patch for blkif.py for disk = [ "drbd:resname,xvda,w" ] syntax (565 bytes, patch)
2009-09-24 07:12 CDT, Andrey Zentavr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ben timby 2009-03-25 13:55:25 CDT
I ran into this problem when I installed CentOS into a Xen domU using the
HowTo:

http://wiki.centos.org/HowTos/Xen/InstallingCentOSDomU

After installation, you are urged to use bootloader=”/usr/bin/pygrub”

However, trying to start the domU results in the error “Error: Disk
isn’t accessible”. A google search turns up speculation that this is
somehow pygrub’s fault, however, if one runs pygrub /dev/drbd0, it
works as expected.

The problem is in the xm utility, it attempts to resolve the disk name
(drbd0) into a device name (/dev/drbd0) by using the disk type (drbd).
However, it does not recognize the type drbd, so it fails to do so.
Attached is a patch that simply treats a drbd disk like phy and
returns “/dev/%s” % “drbd0″.

I realize that a resource (drbd0) may actually use a different device
node than /dev/drbd0, however, resolving this would require parsing
the drbd.conf file and also using the current host name to locate the
correct “on” section. I figure this patch is good enough to work for
most folks.
Comment 1 ben timby 2009-03-25 13:55:53 CDT
Created attachment 855 [details]
Fixes the issue.
Comment 2 Andrey Zentavr 2009-09-24 04:18:42 CDT
Some another diff, that expects
disk = [ "drbd:resname,xvda,w" ]
=============================================
diff -rupN util/blkif.py util.new/blkif.py
--- util/blkif.py       2009-06-12 19:05:57.000000000 +0300
+++ util.new/blkif.py   2009-09-24 14:01:50.000000000 +0300
@@ -72,6 +72,8 @@ def blkdev_uname_to_file(uname):
         (typ, fn) = uname.split(":", 1)
         if typ == "phy" and not fn.startswith("/"):
             fn = "/dev/%s" %(fn,)
+        if typ == "drbd" and not fn.startswith("/"):
+           fn = string.strip(os.popen('drbdadm sh-dev ' + "%s"
%(fn,)).readline(), " \n")
         if typ == "tap":
             (typ, fn) = fn.split(":", 1)
     return fn
Comment 3 Andrey Zentavr 2009-09-24 07:09:45 CDT
Created attachment 880 [details]
Patch for pygrub for disk = [ "drbd:resname,xvda,w" ] syntax
Comment 4 Andrey Zentavr 2009-09-24 07:12:25 CDT
Created attachment 881 [details]
Patch for blkif.py for disk = [ "drbd:resname,xvda,w" ] syntax
Comment 5 Trevor Hemsley 2011-06-24 13:52:20 CDT
The patch to pygrub here is broken for me on DRBD 8.0 and 8.3 on CentOS 5.6 and
on Ubuntu 8.04 LTS. It uses

drbdresource = string.strip(os.popen('drbdadm sh-resources ' +
file).readline(), " \n")

to get info about the resource it wants but drbdadm sh-resources silently
ignores any arguments passed to it and displays ALL DRBD resources. This list
later gets passed to drbdadm primary which makes all DRBD resources on this
host primary (or attempts to). This is incorrect behaviour - indeed, it's very
bad!
Comment 6 Trevor Hemsley 2011-06-24 14:00:24 CDT
A patch for the patches attached here says something like this

--- pygrub      2011-06-24 21:54:52.000000000 +0100
+++ /usr/bin/pygrub     2011-06-24 21:56:44.000000000 +0100
@@ -679,8 +688,9 @@
     """ 
     drbdcount = string.strip(os.popen('drbdadm sh-dev all | grep ' + file + '
| wc -l').readline(), " \n")
     if drbdcount == '1':
-       drbdresource = string.strip(os.popen('drbdadm sh-resources ' +
file).readline(), " \n")
-       peerstate = string.strip(os.popen('drbdadm state ' +
drbdresource).readline(), " \n").lower().split("/",1)[0]
+        minor = file[9:]
+        drbdresource = string.strip(os.popen('drbdadm sh-resource minor-' +
minor).readline(), " \n")
+       peerstate = string.strip(os.popen('drbdadm role ' +
drbdresource).readline(), " \n").lower().split("/",1)[0]

        if peerstate == "unknown":
            print "DRBD resource " + drbdresource + " is " + peerstate + " on
peer. Maybe split brain state?"
Comment 7 Todd Deshane 2011-06-24 18:46:57 CDT
Bugzilla is not heavily used. Did you report this to the xen-devel mailing
list?

http://wiki.xen.org/xenwiki/ReportingBugs