-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from IBM/master
Sync
- Loading branch information
Showing
36 changed files
with
846 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
cland_root_dir=/opt/cloudland | ||
cd $(dirname $0) | ||
|
||
[ $PWD != "$cland_root_dir/deploy" ] && echo "Please clone cloudland into /opt" && exit 1 | ||
|
||
sudo chown -R centos.centos /opt/cloudland | ||
|
||
# Install development tools | ||
sudo yum install -y ansible vim git wget epel-release | ||
sudo yum groupinstall -y "Development Tools" | ||
|
||
# Install SCI | ||
function inst_sci() | ||
{ | ||
cd $cland_root_dir/sci | ||
./configure | ||
make | ||
sudo make install | ||
} | ||
|
||
# Install GRPC | ||
function inst_grpc() { | ||
cd $cland_root_dir | ||
git clone https://github.com/grpc/grpc.git | ||
cd grpc | ||
git submodule update --init | ||
cd third_party/protobuf/ | ||
./autogen.sh | ||
./configure | ||
make | ||
sudo make install | ||
sudo bash -c 'echo /usr/local/lib > /etc/ld.so.conf.d/protobuf.conf' | ||
sudo ldconfig | ||
cd ../../ | ||
make | ||
sudo make install | ||
DIR=$PWD | ||
cat > activate.sh <<EOF | ||
export PATH=$PATH:/usr/local/bin:$DIR/bins/opt:$DIR/bins/opt/protobuf | ||
export CPATH=$DIR/include:$DIR/third_party/protobuf/src | ||
export LIBRARY_PATH=$DIR/libs/opt:$DIR/libs/opt/protobuf | ||
export PKG_CONFIG_PATH=$DIR/libs/opt/pkgconfig:$DIR/third_party/protobuf | ||
export LD_LIBRARY_PATH=$DIR/libs/opt | ||
EOF | ||
} | ||
|
||
# Install web | ||
function install_web() | ||
{ | ||
sudo yum -y install golang postgresql | ||
sudo chown -R centos.centos /usr/local | ||
} | ||
|
||
# Install cloudland | ||
function inst_cland() | ||
{ | ||
cd $cland_root_dir/src | ||
source $cland_root_dir/grpc/activate.sh | ||
make | ||
make install | ||
} | ||
|
||
diff /opt/sci/lib64/libsci.so.0.0.0 $cland_root_dir/sci/libsci/.libs/libsci.so.0.0.0 | ||
[ $? -ne 0 ] && inst_sci | ||
[ ! -f "$cland_root_dir/grpc/activate.sh" ] && inst_grpc | ||
diff $cland_root_dir/bin/cloudland $cland_root_dir/src/cloudland | ||
[ $? -ne 0 ] && inst_cland | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0) | ||
source ../cloudrc | ||
|
||
[ $# -lt 3 ] && echo "$0 <vm_ID> <volume_ID> <volume_path>" && exit -1 | ||
|
||
vm_ID=inst-$1 | ||
vol_ID=$2 | ||
vol_path=$gluster_volume/$3 | ||
vol_xml=$xml_dir/$vm_ID/disk-${vol_ID}.xml | ||
cp $template_dir/volume.xml $vol_xml | ||
count=$(virsh dumpxml $vm_ID | grep -c "<disk type='network' device='disk'>") | ||
let letter=98+$count | ||
device=vd$(printf "\\$(printf '%03o' "$letter")") | ||
sed -i "s#VOLUME_SOURCE#$vol_path#g;s#VOLUME_TARGET#$device#g;" $vol_xml | ||
virsh attach-device $vm_ID $vol_xml --config --persistent | ||
if [ $? -eq 0 ]; then | ||
echo "|:-COMMAND-:| $(basename $0) '$1' '$vol_ID' '$device'" | ||
else | ||
echo "|:-COMMAND-:| $(basename $0) '' '$vol_ID' ''" | ||
fi | ||
vm_xml=$xml_dir/$vm_ID/$vm_ID.xml | ||
virsh dumpxml --security-info $vm_ID 2>/dev/null | sed "s/autoport='yes'/autoport='no'/g" > $vm_xml.dump && mv -f $vm_xml.dump $vm_xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0) | ||
source ../cloudrc | ||
|
||
[ $# -lt 2 ] && die "$0 <vol_ID> <path>" | ||
|
||
vol_ID=$1 | ||
path=$2 | ||
|
||
rm -f $volume_dir/$path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
|
||
cd `dirname $0` | ||
cd $(dirname $0) | ||
source ../cloudrc | ||
|
||
[ $# -lt 1 ] && die "$0 <vlan>" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0) | ||
source ../cloudrc | ||
|
||
[ $# -lt 2 ] && echo "$0 <vol_ID> <size>" && exit -1 | ||
|
||
vol_ID=$1 | ||
size=$2 | ||
state='error' | ||
|
||
qemu-img create -f qcow2 -o cluster_size=2M $volume_dir/volume-${vol_ID}.disk ${size}G | ||
[ $? -eq 0 ] && state='available' | ||
echo "|:-COMMAND-:| $(basename $0) '$vol_ID' 'volume-${vol_ID}.disk' '$state'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0) | ||
source ../cloudrc | ||
|
||
[ $# -lt 2 ] && echo "$0 <vm_ID> <volume_ID>" && exit -1 | ||
|
||
vm_ID=inst-$1 | ||
vol_ID=$2 | ||
vol_xml=$xml_dir/$vm_ID/disk-${vol_ID}.xml | ||
virsh detach-device $vm_ID $vol_xml --config --persistent | ||
if [ $? -eq 0 ]; then | ||
echo "|:-COMMAND-:| $(basename $0) '$1' '$vol_ID'" | ||
else | ||
echo "|:-COMMAND-:| $(basename $0) '' '$vol_ID'" | ||
fi | ||
vm_xml=$xml_dir/$vm_ID/$vm_ID.xml | ||
virsh dumpxml --security-info $vm_ID 2>/dev/null | sed "s/autoport='yes'/autoport='no'/g" > $vm_xml.dump && mv -f $vm_xml.dump $vm_xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<disk type='network' device='disk'> | ||
<driver name='qemu' type='qcow2' cache='none'/> | ||
<source protocol='gluster' name='VOLUME_SOURCE'> | ||
<host name='localhost' port='24007'/> | ||
</source> | ||
<backingStore/> | ||
<target dev='VOLUME_TARGET' bus='virtio'/> | ||
</disk> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e7acfeb | ||
40d796c |
Binary file not shown.
Oops, something went wrong.