Skip to contentSkip to conversation

inetd enabled qemu-nbd

PATCH Superseded Jun Sheng 1 participant 1 message Nov 2, 2014

lore
Share & tools
lore

Jun Sheng

author
#0 lore raw

PATCH v2 1/1 inetd enabled qemu-nbd

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

}