#!/bin/bash

# This is a regression test for https://launchpad.net/bugs/2054470

set -ex -o pipefail

# Setup
modprobe nbd
truncate -s 1G /vol-0.img

# Configure
cat > /etc/nbd-server/conf.d/exports.conf << _EOF_
[vol0]
exportname = /vol-0.img
_EOF_

cat >> /etc/nbdtab << _EOF_
nbd0 127.0.0.1 vol0
_EOF_

systemctl restart nbd-server.service

# Now parse the ipv4 address from nbdtab
nbd-client nbd0
