/[sysadmin-cookbook]/recepies/kvm/image-device.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /recepies/kvm/image-device.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 52 - (hide annotations)
Mon May 11 21:48:57 2009 UTC (15 years ago) by dpavlin
File MIME type: application/x-sh
File size: 304 byte(s)
turn qemu/kvm image into nbd device

1 dpavlin 52 #!/bin/sh -x
2    
3     test -e $1 || ( echo echo "Usage: $0 image.qcow2" ; exit 1 )
4    
5     image=$1
6     path=$2
7     running=`ps ax | grep nbd | grep -v grep | wc -l`
8     port=`expr 10000 + $running`
9    
10     kvm-nbd --port $port $image &
11     echo $! > $image.pid
12    
13     nbd-client localhost $port /dev/nbd$running || exit
14    
15     fdisk -l /dev/nbd$running

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26