From ea4a823810c4b7794bf540bd26f2e3b1b8788fbb Mon Sep 17 00:00:00 2001
From: Gregory Haynes <greg@greghaynes.net>
Date: Wed, 15 Apr 2015 20:20:12 +0000
Subject: [PATCH] Remove unused map_nbd function

This is a leftover from when we used nbd. We no longer do and this
function is not used.

Change-Id: If037bdd0100ef27401ddd5931ec3db7017302675
---
 lib/common-functions | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/lib/common-functions b/lib/common-functions
index e7cccd30f..e261f4984 100644
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -118,36 +118,6 @@ function eval_run_d () {
   fi
 }
 
-# Usage: map_nbd $image
-# Returns nbd device path
-function map_nbd {
-    (lsmod | grep '^nbd ' >/dev/null) || sudo modprobe nbd max_part=16
-
-    if [[ $(qemu-nbd --help | grep cache) == *writeback* ]] ; then
-        CACHE="--cache=writeback"
-    else
-        echo "Warning: qemu-nbd without --cache=writeback is /slow/."
-        CACHE=""
-    fi
-    NBD_DEV=
-    for i in `seq 0 15`; do
-        if [ ! -e /sys/block/nbd$i/pid ]; then
-            NBD_DEV=/dev/nbd$i
-            # Connect to nbd and wait till it is ready
-            sudo qemu-nbd -c $NBD_DEV $CACHE $1
-            if ! timeout 60 sh -c "while ! [ -e /sys/block/nbd$i/pid ]; do sleep 1; done"; then
-                echo "Couldn't connect $NBD_DEV"
-                exit 1
-            fi
-            break
-        fi
-    done
-    if [ -z "$NBD_DEV" ]; then
-        echo "No free NBD slots"
-        exit 1
-    fi
-}
-
 # Delete and unmount the working dir used in extracting kernel/initrd
 function unmount_qcow_image () {
     sudo umount $WORK_DIR || true