Skip to content

Commit cc0f129

Browse files
committed
Merge pull request #95 from xapi-project/improve-setup
Improvements to setup.sh
2 parents 8f64a29 + 32964be commit cc0f129

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

cleanup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ if [ "$EUID" -ne "0" ]; then
44
echo "Please run me as uid 0. I need to create a loop device and device mapper devices"
55
exit 1
66
fi
7-
7+
LOOP=$(losetup -j bigdisk | cut -f 1 -d ':')
88
./xenvm.native lvchange -an /dev/djstest/live || true
99
#./xenvm.native shutdown /dev/djstest
1010
killall xenvmd.native
1111
dmsetup remove_all
12-
dd if=/dev/zero of=/dev/loop0 bs=1M count=128
13-
losetup -d /dev/loop0
12+
dd if=/dev/zero of=$LOOP bs=1M count=128
13+
losetup -d $LOOP
1414
rm -f localJournal bigdisk *.out

setup.sh

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,48 @@ fi
1515
# Making a 1G disk
1616
rm -f bigdisk _build/xenvm*.out
1717
dd if=/dev/zero of=bigdisk bs=1 seek=256G count=0
18-
echo Using /dev/loop0
19-
losetup /dev/loop0 bigdisk
20-
cat test.xenvmd.conf.in | sed -r "s|@BIGDISK@|/dev/loop0|g" > test.xenvmd.conf
18+
19+
LOOP=$(losetup -f)
20+
echo Using $LOOP
21+
losetup $LOOP bigdisk
22+
cat test.xenvmd.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" > test.xenvmd.conf
2123
mkdir -p /etc/xenvm.d
22-
BISECT_FILE=_build/xenvm.coverage ./xenvm.native format /dev/loop0 --vg djstest
24+
BISECT_FILE=_build/xenvm.coverage ./xenvm.native format $LOOP --vg djstest
2325
BISECT_FILE=_build/xenvmd.coverage ./xenvmd.native --config ./test.xenvmd.conf --daemon
2426

2527
export BISECT_FILE=_build/xenvm.coverage
2628

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
29+
./xenvm.native set-vg-info --pvpath $LOOP -S /tmp/xenvmd djstest --local-allocator-path /tmp/xenvm-local-allocator --uri file://local/services/xenvmd/djstest
2830

2931
./xenvm.native lvcreate -n live -L 4 djstest
3032
./xenvm.native lvchange -ay /dev/djstest/live
3133

3234
#./xenvm.native benchmark
33-
35+
# create and connect to hosts
3436
./xenvm.native host-create /dev/djstest host1
35-
#./xenvm.native host-connect /dev/djstest host1
37+
./xenvm.native host-connect /dev/djstest host1
38+
cat test.local_allocator.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" | sed -r "s|@HOST@|host1|g" > test.local_allocator.host1.conf
39+
./local_allocator.native --config ./test.local_allocator.host1.conf > /dev/null &
40+
41+
./xenvm.native host-create /dev/djstest host2
42+
./xenvm.native host-connect /dev/djstest host2
43+
cat test.local_allocator.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" | sed -r "s|@HOST@|host2|g" > test.local_allocator.host2.conf
44+
./local_allocator.native --config ./test.local_allocator.host2.conf > /dev/null &
45+
46+
sleep 30
47+
./xenvm.native host-list /dev/djstest
48+
49+
# destroy hosts
50+
./xenvm.native host-disconnect /dev/djstest host2
51+
./xenvm.native host-destroy /dev/djstest host2
52+
./xenvm.native host-disconnect /dev/djstest host1
53+
./xenvm.native host-destroy /dev/djstest host1
54+
55+
./xenvm.native host-list /dev/djstest
56+
57+
#shutdown
58+
./xenvm.native lvchange -an /dev/djstest/live || true
59+
./xenvm.native shutdown /dev/djstest
3660

3761
#echo Run 'sudo ./xenvm.native host-connect /dev/djstest host1' to connect to the local allocator'
3862
#echo Run 'sudo ./local_allocator.native' and type 'djstest-live' to request an allocation

0 commit comments

Comments
 (0)