|
8 | 8 | # already included in the RPM. |
9 | 9 |
|
10 | 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 |
| 11 | + echo "I am not running with EUID 0. I will use the mock device mapper interface" |
| 12 | + USE_MOCK=1 |
| 13 | + MOCK_ARG="--mock-devmapper" |
| 14 | +else |
| 15 | + echo "I am running with EUID 0. I will use the real device mapper interface" |
| 16 | + USE_MOCK=0 |
| 17 | + MOCK_ARG="" |
13 | 18 | fi |
14 | 19 |
|
15 | 20 | # Making a 1G disk |
16 | | -rm -f bigdisk _build/xenvm*.out |
| 21 | +rm -f bigdisk |
17 | 22 | dd if=/dev/zero of=bigdisk bs=1 seek=256G count=0 |
18 | 23 |
|
19 | | -LOOP=$(losetup -f) |
20 | | -echo Using $LOOP |
21 | | -losetup $LOOP bigdisk |
| 24 | +if [ "$USE_MOCK" -eq "0" ]; then |
| 25 | + LOOP=$(losetup -f) |
| 26 | + echo Using $LOOP |
| 27 | + losetup $LOOP bigdisk |
| 28 | +else |
| 29 | + LOOP=`pwd`/bigdisk |
| 30 | +fi |
22 | 31 | cat test.xenvmd.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" > test.xenvmd.conf |
23 | | -mkdir -p /etc/xenvm.d |
24 | | -BISECT_FILE=_build/xenvm.coverage ./xenvm.native format $LOOP --vg djstest |
| 32 | +mkdir -p /tmp/xenvm.d |
| 33 | +BISECT_FILE=_build/xenvm.coverage ./xenvm.native format $LOOP --vg djstest --configdir /tmp/xenvm.d $MOCK_ARG |
25 | 34 | BISECT_FILE=_build/xenvmd.coverage ./xenvmd.native --config ./test.xenvmd.conf --daemon |
26 | 35 |
|
27 | 36 | export BISECT_FILE=_build/xenvm.coverage |
28 | 37 |
|
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 |
| 38 | +./xenvm.native set-vg-info --pvpath $LOOP -S /tmp/xenvmd djstest --local-allocator-path /tmp/xenvm-local-allocator --uri file://local/services/xenvmd/djstest --configdir /tmp/xenvm.d $MOCK_ARG |
30 | 39 |
|
31 | | -./xenvm.native lvcreate -n live -L 4 djstest |
32 | | -./xenvm.native lvchange -ay /dev/djstest/live |
| 40 | +./xenvm.native lvcreate -n live -L 4 djstest --configdir /tmp/xenvm.d $MOCK_ARG |
| 41 | +./xenvm.native lvchange -ay /dev/djstest/live --configdir /tmp/xenvm.d $MOCK_ARG |
33 | 42 |
|
34 | 43 | #./xenvm.native benchmark |
35 | 44 | # create and connect to hosts |
36 | | -./xenvm.native host-create /dev/djstest host1 |
37 | | -./xenvm.native host-connect /dev/djstest host1 |
| 45 | +./xenvm.native host-create /dev/djstest host1 --configdir /tmp/xenvm.d $MOCK_ARG |
| 46 | +./xenvm.native host-connect /dev/djstest host1 --configdir /tmp/xenvm.d $MOCK_ARG |
38 | 47 | 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 & |
| 48 | +./local_allocator.native --config ./test.local_allocator.host1.conf $MOCK_ARG > /dev/null & |
40 | 49 |
|
41 | | -./xenvm.native host-create /dev/djstest host2 |
42 | | -./xenvm.native host-connect /dev/djstest host2 |
| 50 | +./xenvm.native host-create /dev/djstest host2 --configdir /tmp/xenvm.d $MOCK_ARG |
| 51 | +./xenvm.native host-connect /dev/djstest host2 --configdir /tmp/xenvm.d $MOCK_ARG |
43 | 52 | 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 & |
| 53 | +./local_allocator.native --config ./test.local_allocator.host2.conf $MOCK_ARG > /dev/null & |
45 | 54 |
|
46 | 55 | sleep 30 |
47 | | -./xenvm.native host-list /dev/djstest |
| 56 | +./xenvm.native host-list /dev/djstest --configdir /tmp/xenvm.d $MOCK_ARG |
48 | 57 |
|
49 | 58 | # 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 |
| 59 | +./xenvm.native host-disconnect /dev/djstest host2 --configdir /tmp/xenvm.d $MOCK_ARG |
| 60 | +./xenvm.native host-destroy /dev/djstest host2 --configdir /tmp/xenvm.d $MOCK_ARG |
| 61 | +./xenvm.native host-disconnect /dev/djstest host1 --configdir /tmp/xenvm.d $MOCK_ARG |
| 62 | +./xenvm.native host-destroy /dev/djstest host1 --configdir /tmp/xenvm.d $MOCK_ARG |
54 | 63 |
|
55 | | -./xenvm.native host-list /dev/djstest |
| 64 | +./xenvm.native host-list /dev/djstest --configdir /tmp/xenvm.d $MOCK_ARG |
56 | 65 |
|
57 | 66 | #shutdown |
58 | | -./xenvm.native lvchange -an /dev/djstest/live || true |
59 | | -./xenvm.native shutdown /dev/djstest |
| 67 | +./xenvm.native lvchange -an /dev/djstest/live --configdir /tmp/xenvm.d $MOCK_ARG || true |
| 68 | +./xenvm.native shutdown /dev/djstest --configdir /tmp/xenvm.d $MOCK_ARG |
60 | 69 |
|
61 | 70 | #echo Run 'sudo ./xenvm.native host-connect /dev/djstest host1' to connect to the local allocator' |
62 | 71 | #echo Run 'sudo ./local_allocator.native' and type 'djstest-live' to request an allocation |
|
0 commit comments