forked from XIA-Project/GENI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathximage
executable file
·47 lines (36 loc) · 1.52 KB
/
ximage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# creates a disk image from a running node in the specified slice/aggregate
#
# This script was written on OS X. To run on linux the following definition should be changed
#
omni="/Applications/omniTools-2.6/omni.app/Contents/MacOS/omni --error"
file="*-listimages-*"
if [ $# -ne 4 ]; then
echo usage: ximage imagename slicename hostname aggregate
echo where:
echo " imagename is the name for the new disk image"
echo " slicename is the slice to image from"
echo " hostname is the host in the slice to image"
echo " aggregate is the GENI location where the slice is running"
exit 1
fi
iname=$1
sname=$2
hname=$3
agg=$4
# get a json file containing the status of the nodes in the slice
$omni sliverstatus -a $agg $sname -o
# really ugly but quick command to extract the urn of the host we want to image
# ignore the grep error, I have no idea where it's coming from
urn=`cat $sname-sliverstatus-utahddc-geniracks-net.json| tr '\n' ' ' | tr '}' '\n' | grep geni_client_id | grep $hname | tr "," "\n" | grep sliver_id | cut -d \" -f4`
# delete the json file
rm $sname-sliverstatus-utahddc-geniracks-net.json
# create the disk image
$omni createimage -a $agg $sname $iname -u $urn
echo paste the following line into your rspec file in place of the old disk image lines
$omni listimages -a $agg -o
url=`cat $file | tr "\n" " " | tr "\}" "\n" | grep $iname | cut -d \" -f 4`
urn=`cat $file | tr "\n" " " | tr "\}" "\n" | grep $iname | cut -d \" -f 8`
rm $file
printf "\n\n<disk_image url=\"$url\"\n\tname=\"$urn\"/>\n\n"