# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-_have_nbd_netlink_support() {
+_have_nbd() {
+ _have_module nbd && _have_program nbd-server && \
+ _have_program nbd-client
+}
+
+_have_nbd_netlink() {
+ if ! _have_nbd; then
+ return 1
+ fi
if ! _have_program genl-ctrl-list; then
return 1
fi
return 0
}
-_have_nbd_netlink() {
- _have_nbd && _have_nbd_netlink_support
-}
-
_start_nbd_server() {
truncate -s 10G "${TMPDIR}/export"
cat > "${TMPDIR}/nbd.conf" << EOF
_have_module loop && _have_program losetup
}
-_have_nbd() {
- _have_module nbd && _have_program nbd-server && \
- _have_program nbd-client
-}
-
_have_blktrace() {
# CONFIG_BLK_DEV_IO_TRACE might still be disabled, but this is easier
# to check. We can fix it if someone complains.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. common/nbd
-
DESCRIPTION="resize a connected nbd device"
QUICK=1
test() {
echo "Running ${TEST_NAME}"
_start_nbd_server
- nbd-client -N export localhost /dev/nbd0 > /dev/null 2>&1
- parted -s /dev/nbd0 print 2> /dev/null | grep 'Disk /dev/nbd0'
+ nbd-client -N export localhost /dev/nbd0 >> "$FULL" 2>&1
+ parted -s /dev/nbd0 print 2>> "$FULL" | grep 'Disk /dev/nbd0'
lsblk -n /dev/nbd0
echo "Setting size to 1gib"
src/nbdsetsize /dev/nbd0 1073741824
lsblk -n /dev/nbd0
- parted -s /dev/nbd0 print 2> /dev/null | grep 'Disk /dev/nbd0'
+ parted -s /dev/nbd0 print 2>> "$FULL" | grep 'Disk /dev/nbd0'
- nbd-client -d /dev/nbd0 > /dev/null 2>&1
+ nbd-client -d /dev/nbd0 >> "$FULL" 2>&1
_stop_nbd_server
}
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+. common/nbd
+
group_requires() {
_have_root && _have_nbd && modprobe nbd
}