xenapi: /boot/guest should point to local SR

Fixes bug 1037516

This patch creates a directory os-guest-kernels inside the local SR, and
sets up /boot/guest to be a symlink to that directory. This way
OpenStack won't pollute Dom0's filesystem.

Change-Id: If8dfe24355bd782a401fed0f2c4b423efd9c11ba
diff --git a/tools/xen/mocks b/tools/xen/mocks
index b006558..6da6acb 100644
--- a/tools/xen/mocks
+++ b/tools/xen/mocks
@@ -12,6 +12,18 @@
     exit 1
 }
 
+test ! -e "$XE_RESPONSE" && {
+    echo "Mocking is not set up properly."
+    echo "XE_RESPONSE should point to an existing file."
+    exit 1
+}
+
+test ! -e "$XE_CALLS" && {
+    echo "Mocking is not set up properly."
+    echo "XE_CALLS should point to an existing file."
+    exit 1
+}
+
 function mktemp {
     if test "${1:-}" = "-d";
     then
@@ -41,6 +53,10 @@
     echo "rm $@" >> $LIST_OF_ACTIONS
 }
 
+function ln {
+    echo "ln $@" >> $LIST_OF_ACTIONS
+}
+
 function [ {
     if test "${1:-}" = "-d";
     then
@@ -57,3 +73,13 @@
     echo "Mock test does not implement the requested function"
     exit 1
 }
+
+function xe {
+    cat $XE_RESPONSE
+    {
+    for i in $(seq "$#")
+    do
+        eval "echo \"\$$i\""
+    done
+    } >> $XE_CALLS
+}