NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-xen/47899: xen block script does not create vnd devices when needed.



The following reply was made to PR port-xen/47899; it has been noted by GNATS.

From: Pierre Pronchery <khorben%defora.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: port-xen/47899: xen block script does not create vnd devices
 when needed.
Date: Thu, 06 Jun 2013 04:00:34 +0200

 This is a multi-part message in MIME format.
 --------------040700010609060508010203
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
                        Hi 7heo,
 
 On 05/06/2013 22:30, 7heo%7heo.tk@localhost wrote:
 > [...]
 > By default, NetBSD has 4 (four) vnd devices, /dev/vnd0, /dev/vnd1,
 > /dev/vnd2 and /dev/vnd3.
 > 
 > When one creates a virtual machine with a disk from a file, the
 > block script uses vnconfig to "mount" the image on a vnd loopback device.
 > 
 > When the Xen toolstack (xm) needs to mount more than 4 images at the
 > same time, it fails, instead of increasing the number of vnd devices to
 > a suited quantity.
 
 Good catch.
 
 Can you try the patch attached? It should attempt to create the missing
 nodes automatically.
 
 For some reason "vnconfig -l" seems to only ever lists the four first
 vnd devices, regardless of the existence of the corresponding device
 nodes, but that's a separate issue.
 
 HTH,
 -- 
 khorben
 
 --------------040700010609060508010203
 Content-Type: text/plain; charset=ISO-8859-15;
  name="patch-xentools_block_create_vnd.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="patch-xentools_block_create_vnd.diff"
 
 --- /usr/pkg/etc/xen/scripts/block     2013-04-10 01:51:03.000000000 +0200
 +++ /usr/pkg/etc/xen/scripts/block.new 2013-06-06 03:53:49.000000000 +0200
 @@ -46,14 +46,15 @@
        file)
                # Store the list of available vnd(4) devices in
                #``available_disks'', and mark them as ``free''.
 -              list=`ls -1 /dev/vnd[0-9]*d | sed "s,/dev/vnd,,;s,d,," | sort 
-n`
 -              for i in $list; do
 -                      disk="vnd$i"
 +              i=0
 +              while [ -b /dev/vnd${i}d ]; do
 +                      disk=vnd$i
                        available_disks="$available_disks $disk"
                        eval $disk=free
 +                      i=$((i + 1))
                done
                # Mark the used vnd(4) devices as ``used''.
 -              for disk in `sysctl hw.disknames`; do
 +              for disk in $(sysctl hw.disknames); do
                        case $disk in
                        vnd[0-9]*) eval $disk=used ;;
                        esac
 @@ -68,6 +69,13 @@
                                break   
                        fi
                done
 +              # Attempt to create a new device node
 +              if [ x$device = x ] && \
 +                              (cd /dev && ./MAKEDEV vnd$i) && \
 +                              vnconfig /dev/vnd${i}d $xparams >/dev/null; then
 +                      device=/dev/vnd${i}d
 +                      echo vnconfig /dev/vnd${i}d $xparams
 +              fi
                if [ x$device = x ] ; then
                        error "no available vnd device"
                fi
 
 --------------040700010609060508010203--
 


Home | Main Index | Thread Index | Old Index