run qemu-nbd as an inetd service has some benefits * more scriptable, such as serve multiple images to different clients on one ip/port * access control using tcpd
simple usage: #!/bin/sh # qemu-nbd wrapper, select image file according to client ip address IMG_FILE=`sed -n "s/$REMOTE_HOST //p" /path/to/image_list.txt` qemu-nbd -i 10 $IMG_FILE 10<&0- 1>/tmp/log 2>/tmp/log2 #end #xinetd.conf service nbd { flags = REUSE socket_type = stream wait = no user = some_user server = /path/to/qemu-nbd-wrapper.sh log_on_failure += USERID disable = no } Signed-off-by: Jun Sheng <chaoseter...@gmail.com>