* [PATCH] Allow Xend to find device number for sdX or hdX with udev
@ 2005-01-14 21:00 Anthony Liguori
2005-01-15 10:38 ` Felipe Alfaro Solana
2005-01-17 12:17 ` Nuutti Kotivuori
0 siblings, 2 replies; 5+ messages in thread
From: Anthony Liguori @ 2005-01-14 21:00 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 594 bytes --]
Symptom:
When using a udev-based dom0, if you try to create a domU with a virtual
sda device and you do not have a local scsi device xm create fails.
Fix:
When using udev, only the device nodes needed are made. The follow
patch changes Xend to return a device number based on:
http://www.lanana.org/docs/device-list/devices.txt
For sd and hd devices if stat() fails. It was tested against both 2.0.2
and 2.0.3.
Regards,
--
Anthony Liguori
Linux Technology Center (LTC) - IBM Austin
E-mail: aliguori@us.ibm.com
Phone: (512) 838-1208
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
[-- Attachment #2: xen_udev.diff --]
[-- Type: text/x-patch, Size: 830 bytes --]
Only in xen-2.0-new/tools/python/xen/lowlevel/xu: xu.c~
diff -ur xen-2.0/tools/python/xen/xend/server/blkif.py xen-2.0-new/tools/python/xen/xend/server/blkif.py
--- xen-2.0/tools/python/xen/xend/server/blkif.py 2005-01-03 21:46:13.000000000 -0600
+++ xen-2.0-new/tools/python/xen/xend/server/blkif.py 2005-01-12 18:40:17.648463000 -0600
@@ -63,6 +63,12 @@
log.debug("exception looking up device number for %s: %s", name, ex)
pass
+ if re.match( '/dev/sd[a-p]([0-9]|1[0-5])', n):
+ return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
+
+ if re.match( '/dev/hd[a-p]([0-9]|[1-5][0-9]|6[0-3])', n):
+ return 3 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
+
# see if this is a hex device number
if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
return string.atoi(name,16)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow Xend to find device number for sdX or hdX with udev
2005-01-14 21:00 [PATCH] Allow Xend to find device number for sdX or hdX with udev Anthony Liguori
@ 2005-01-15 10:38 ` Felipe Alfaro Solana
2005-01-15 10:56 ` Jan Kundrát
2005-01-17 12:17 ` Nuutti Kotivuori
1 sibling, 1 reply; 5+ messages in thread
From: Felipe Alfaro Solana @ 2005-01-15 10:38 UTC (permalink / raw)
To: Anthony Liguori; +Cc: xen-devel
On 14 Jan 2005, at 22:00, Anthony Liguori wrote:
> Symptom:
> When using a udev-based dom0, if you try to create a domU with a
> virtual
> sda device and you do not have a local scsi device xm create fails.
>
> Fix:
> When using udev, only the device nodes needed are made. The follow
> patch changes Xend to return a device number based on:
>
> http://www.lanana.org/docs/device-list/devices.txt
>
> For sd and hd devices if stat() fails. It was tested against both
> 2.0.2
> and 2.0.3.
Another solution is to tell udev to automatically create /dev/sda1
every time it gets started:
# mknod /etc/udev/devices b 8 1
When udev starts, all device files inside /etc/udev/devices are
automatically copied to /dev, with no further configuration or
triggering of hotplug or coldplug events.
NOTE: This is what I use for VMware, which needs a lot of /dev/vm*
devices to function properly: I moved all VMware-specific device files
into /etc/udev/devices so when udev starts, those files are copied back
to /dev.
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow Xend to find device number for sdX or hdX with udev
2005-01-15 10:38 ` Felipe Alfaro Solana
@ 2005-01-15 10:56 ` Jan Kundrát
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kundrát @ 2005-01-15 10:56 UTC (permalink / raw)
To: Felipe Alfaro Solana; +Cc: Anthony Liguori, xen-devel
Felipe Alfaro Solana wrote:
> When udev starts, all device files inside /etc/udev/devices are
> automatically copied to /dev, with no further configuration or
> triggering of hotplug or coldplug events.
It depends on your distribution, for example gentoo doesn't use
/etc/udev/devices/, but /lib/udev-state/devices.tar.bz2.
-jkt
--
cd /local/pub && more beer > /dev/mouth
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow Xend to find device number for sdX or hdX with udev
2005-01-14 21:00 [PATCH] Allow Xend to find device number for sdX or hdX with udev Anthony Liguori
2005-01-15 10:38 ` Felipe Alfaro Solana
@ 2005-01-17 12:17 ` Nuutti Kotivuori
2005-01-17 13:11 ` Ian Pratt
1 sibling, 1 reply; 5+ messages in thread
From: Nuutti Kotivuori @ 2005-01-17 12:17 UTC (permalink / raw)
To: xen-devel
Anthony Liguori wrote:
> The follow patch changes Xend to return a device number based on:
>
> http://www.lanana.org/docs/device-list/devices.txt
>
> For sd and hd devices if stat() fails.
I would suggest not using stat() at all, and not using that device
list at all (even though the hd and sd parts are equal ofcourse), but
creating the mapping based on the mapping to the other direction
inside "drivers/xen/blokfront/vbd.c". That file defines the "xvd"
devices in addition to "hd" and "sd" devices.
-- Naked
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [PATCH] Allow Xend to find device number for sdX or hdX with udev
2005-01-17 12:17 ` Nuutti Kotivuori
@ 2005-01-17 13:11 ` Ian Pratt
0 siblings, 0 replies; 5+ messages in thread
From: Ian Pratt @ 2005-01-17 13:11 UTC (permalink / raw)
To: Nuutti Kotivuori; +Cc: xen-devel, Ian.Pratt
> Anthony Liguori wrote:
> > The follow patch changes Xend to return a device number based on:
> >
> > http://www.lanana.org/docs/device-list/devices.txt
> >
> > For sd and hd devices if stat() fails.
>
> I would suggest not using stat() at all, and not using that device
> list at all (even though the hd and sd parts are equal ofcourse), but
> creating the mapping based on the mapping to the other direction
> inside "drivers/xen/blokfront/vbd.c". That file defines the "xvd"
> devices in addition to "hd" and "sd" devices.
We've considered doing the name lookup in blkfront, but there are
complications with it being done so early in the boot sequence,
and each target devices that is supported requires special case
code anyhow.
Passing linux major/minor numbers across the device channel
interface is admittedly rather ugly, but its not a big problem.
Ian
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-17 13:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-14 21:00 [PATCH] Allow Xend to find device number for sdX or hdX with udev Anthony Liguori
2005-01-15 10:38 ` Felipe Alfaro Solana
2005-01-15 10:56 ` Jan Kundrát
2005-01-17 12:17 ` Nuutti Kotivuori
2005-01-17 13:11 ` Ian Pratt
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.