Skip to content

Commit b9b5141

Browse files
committed
Merge pull request #89 from xapi-project/fix-setup-cleanup
Fix the setup.sh and cleanup.sh scripts, for easier testing
2 parents 8df6edb + ce6753a commit b9b5141

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed

cleanup.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
./xenvm.native shutdown
1+
set -ex
2+
3+
if [ "$EUID" -ne "0" ]; then
4+
echo "Please run me as uid 0. I need to create a loop device and device mapper devices"
5+
exit 1
6+
fi
7+
8+
./xenvm.native lvchange -an /dev/djstest/live || true
9+
#./xenvm.native shutdown /dev/djstest
210
killall xenvmd.native
3-
LVS="live"
4-
for i in ${LVS}; do
5-
echo Removing $i
6-
rm -f ./djstest-$i
7-
done
811
dmsetup remove_all
912
dd if=/dev/zero of=/dev/loop0 bs=1M count=128
1013
losetup -d /dev/loop0

setup.sh

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,39 @@
11
set -e
2-
# Making a 1G disk on /dev/loop0
3-
rm -f bigdisk
4-
dd if=/dev/zero of=bigdisk bs=1 seek=16G count=0
2+
set -x
3+
4+
# There is an important bugfix in the master branch. If you see
5+
# ECONNREFUSED you might need this:
6+
# opam pin add conduit git://github.com/mirage/ocaml-conduit -y
7+
# If you are using a XenServer build environment then the patch is
8+
# already included in the RPM.
9+
10+
if [ "$EUID" -ne "0" ]; then
11+
echo "Please run me as uid 0. I need to create a loop device and device mapper devices"
12+
exit 1
13+
fi
14+
15+
# Making a 1G disk
16+
rm -f bigdisk _build/xenvm*.out
17+
dd if=/dev/zero of=bigdisk bs=1 seek=256G count=0
18+
echo Using /dev/loop0
519
losetup /dev/loop0 bigdisk
6-
BISECT_FILE=xenvm.coverage ./xenvm.native format /dev/loop0 --vg djstest
7-
BISECT_FILE=xenvmd.coverage ./xenvmd.native &
20+
cat test.xenvmd.conf.in | sed -r "s|@BIGDISK@|/dev/loop0|g" > test.xenvmd.conf
21+
mkdir -p /etc/xenvm.d
22+
BISECT_FILE=_build/xenvm.coverage ./xenvm.native format /dev/loop0 --vg djstest
23+
BISECT_FILE=_build/xenvmd.coverage ./xenvmd.native --config ./test.xenvmd.conf --daemon
24+
25+
export BISECT_FILE=_build/xenvm.coverage
826

9-
export BISECT_FILE=xenvm.coverage
27+
./xenvm.native set-vg-info --pvpath /dev/loop0 -S /tmp/xenvmd djstest --local-allocator-path /tmp/xenvm-local-allocator --uri file://local/services/xenvmd/djstest
1028

11-
./xenvm.native create --lv live
12-
./xenvm.native activate --lv live `pwd`/djstest-live /dev/loop0
29+
./xenvm.native lvcreate -n live -L 4 djstest
30+
./xenvm.native lvchange -ay /dev/djstest/live
1331

14-
./xenvm.native benchmark
32+
#./xenvm.native benchmark
1533

16-
./xenvm.native host-create host1
17-
./xenvm.native host-connect host1
34+
./xenvm.native host-create /dev/djstest host1
35+
#./xenvm.native host-connect /dev/djstest host1
1836

19-
echo Run 'sudo ./local_allocator.native' and type 'djstest-live' to request an allocation
37+
#echo Run 'sudo ./xenvm.native host-connect /dev/djstest host1' to connect to the local allocator'
38+
#echo Run 'sudo ./local_allocator.native' and type 'djstest-live' to request an allocation
2039
echo Run './cleanup.sh' to remove all volumes and devices

0 commit comments

Comments
 (0)