From 8260223ae409b3ca29e27628c5c572993dbcba76 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 22 Dec 2008 09:07:42 +0000 Subject: MODULES=dep fix for Xen virtual block devices Ferenc seems to be using the xvda1=img1,xvda2=img2 scheme of Xen disks (this is what xentools gets you) rather than the whole disk with partition scheme. In the xvda1/xvda2 scheme /sys/block contains: # ls /sys/block/ ram0 ram1 ram10 ram11 ram12 ram13 ram14 ram15 ram2 ram3 ram4 ram5 ram6 ram7 ram8 ram9 xvda1 xvda2 In the whole disk scheme it contains xvda as you would expect: # ls /sys/block/ loop0 loop1 loop2 loop3 loop4 loop5 loop6 loop7 ram0 ram1 ram10 ram11 ram12 ram13 ram14 ram15 ram2 ram3 ram4 ram5 ram6 ram7 ram8 ram9 xvda I've attached a patch which takes care of this difference. [ remove largest suffix pattern, so that we don't stumble on big minors -maks ] Signed-off-by: maximilian attems --- hook-functions | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hook-functions b/hook-functions index 0ddfcec..da6ddf9 100644 --- a/hook-functions +++ b/hook-functions @@ -283,6 +283,15 @@ dep_add_modules() root=${root#/dev/} block=$(losetup -a \ | awk "/${root}/{print substr(\$3, 7, 3); exit}") + # Xen virtual device /dev/xvdX + elif [ "${root#/dev/xvd}" != "${root}" ]; then + block=${root#/dev/} + # Xen has a mode where only the individual partitions are + # registered with the kernel as well as the usual full disk + # with partition table scheme. + if [ ! -e /sys/block/${block} ] ; then + block=${block%%[0-9]*} + fi # classical root device else block=${root#/dev/} -- cgit v1.2.3