/bugzilla3/
Bugzilla – Bug 1438
Cannot use pygrub with drbd blcok device as xvda.
Last modified: 2011-06-24 18:46:57 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.
Created attachment 855 [details] Fixes the issue.
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
Created attachment 880 [details] Patch for pygrub for disk = [ "drbd:resname,xvda,w" ] syntax
Created attachment 881 [details] Patch for blkif.py for disk = [ "drbd:resname,xvda,w" ] syntax
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!
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?"
Bugzilla is not heavily used. Did you report this to the xen-devel mailing list? http://wiki.xen.org/xenwiki/ReportingBugs