vagrant-g5k 0.0.18 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,58 +0,0 @@
1
- #!/bin/bash
2
-
3
- # This script is borrowed from pmorrillon.
4
- # Thanks to him !
5
-
6
- #OAR -l slash_22=1+{virtual!='none'}/nodes=1,walltime=06:00:00
7
- #OAR --checkpoint 60
8
- #OAR --signal 12
9
-
10
- set -x
11
-
12
- SUBNET_FILE=$1
13
- shift
14
-
15
- # As we chose a stateless designe,let's calculate here the ip and mac
16
- # assuming we got a slash_22
17
- ipnumber=$(($OAR_JOB_ID % 1022))
18
- IP_MAC=$(cat $SUBNET_FILE|head -n $((ipnumber + 1))|tail -n 1)
19
- IP_ADDR=$(echo $IP_MAC|awk '{print $1}')
20
- MAC_ADDR=$(echo $IP_MAC|awk '{print $2}')
21
-
22
- echo $(hostname)
23
- echo "VM IP informations :"
24
- echo "SUBNET_FILE: $SUBNET_FILE"
25
- echo "OAR_JOB_ID : $OAR_JOB_ID"
26
- echo "ipnumber: $ipnumber"
27
- echo "IP_MAC: $IP_MAC"
28
- echo "IP address: $IP_ADDR"
29
- echo "MAC address: $MAC_ADDR"
30
-
31
- # create tap
32
- TAP=$(sudo create_tap)
33
-
34
- # Directory for qcow2 snapshots
35
- export TMPDIR=/tmp
36
-
37
- # Memory allocation
38
- KEEP_SYSTEM_MEM=1 # Gb
39
- TOTAL_MEM=$(cat /proc/meminfo | grep -e '^MemTotal:' | awk '{print $2}')
40
- VM_MEM=$(( ($TOTAL_MEM / 1024) - $KEEP_SYSTEM_MEM * 1024 ))
41
-
42
- # CPU
43
- SMP=$(nproc)
44
-
45
- # Clean shutdown of the VM at the end of the OAR job
46
- clean_shutdown() {
47
- echo "Caught shutdown signal at $(date)"
48
- echo "system_powerdown" | nc -U /tmp/vagrant-g5k.mon
49
- }
50
-
51
- trap clean_shutdown 12
52
-
53
- # Launch virtual machine
54
- #kvm -m $VM_MEM -smp $SMP -drive file=$IMAGE,if=virtio -snapshot -fsdev local,security_model=none,id=fsdev0,path=$HOME -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare -nographic -net nic,model=virtio,macaddr=$MAC_ADDR -net tap,ifname=$TAP,script=no -monitor unix:/tmp/vagrant-g5k.mon,server,nowait -localtime -enable-kvm &
55
- kvm -m $VM_MEM -smp $SMP -fsdev local,security_model=none,id=fsdev0,path=$HOME -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare -nographic -monitor unix:/tmp/vagrant-g5k.mon,server,nowait -localtime -enable-kvm -net nic,model=virtio,macaddr=$MAC_ADDR -net tap,ifname=$TAP,script=no $@ &
56
-
57
- wait
58
-