wdcsx 发表于 2012-10-25 09:02:46

部署openstack的前期

#!/bin/sh
set -x
##############################################:
#pre for openstack local network env,pre for mutil node,and for migration.
#date:2012.10.23
#author:kikupotter
##############################################
if [ $# -ne 1 ]
then
   echo "please specify one    arg.node1,node2,ro master"
   exit 1
fi
#############################################
#main func.
# sub func node1,node2,master.
pre_master(){
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
                address 192.168.0.21
                netmask 255.255.255.0
                network 192.168.0.0
                broadcast 192.168.0.255
                gateway 192.168.0.254
                dns-nameservers 218.85.157.99

EOF
cat >/etc/hostname <<EOF
master
EOF
}
pre_node1(){
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
                address 192.168.0.20
                netmask 255.255.255.0
                network 192.168.0.0
                broadcast 192.168.0.255
                gateway 192.168.0.254
                dns-nameservers 218.85.157.99

EOF
cat >/etc/hostname <<EOF
node1
EOF
}

pre_node2(){
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
                address 192.168.0.23
                netmask 255.255.255.0
                network 192.168.0.0
                broadcast 192.168.0.255
                gateway 192.168.0.254
                dns-nameservers 218.85.157.99

EOF
cat >/etc/hostname <<EOF
node2
EOF
}

#END func.

############################################

case "${1}" in
   master)
            pre_master
             ;;
      node1)
            pre_node1
             ;;
      node2)
            pre_node2
             ;;
         *)
                echo "Please specify master ,ro nodeX"
                exit
             ;;
esac
##############################################
######all node must do for migration########
#update system
apt-get update;apt-get upgrade
apt-get -y install vim
sleep 2
#hosts for dns.
cat > /etc/hosts <<EOF
127.0.0.1            localhost
192.168.0.21      master.cloud.com      master
192.168.0.20      node1.cloud.com      node1
192.168.0.23      node2.cloud.com      node2
EOF


#NOTE: If you are going to use live migration functionality, pre-create system user/group id so they can map directly in cluster setup.
addgroup --system --gid 119 kvm
addgroup --system --gid 118 libvirtd
addgroup --system --gid 117 nova
adduser --system --home /var/lib/libvirt --shell /bin/false --uid 119 --gid 119 --disabled-password libvirt-qemu
adduser --system --home /var/lib/libvirt/dnsmasq --shell /bin/false --uid 118 --gid 118 --disabled-password libvirt-dnsmasq
adduser --system --home /var/lib/nova --shell /bin/false --uid 117 --gid 117 --disabled-password nova
adduser nova libvirtd

reroot
          前期一定要把迁移考虑进来,我也只是在测试阶段,比不上别人,一个人躲在实验室里面折腾,代码写的不好大家见谅哈。主要是完成前期的一些设置工作。我只用三台机子就无所谓变量了。呵呵。求指点!!谢谢哈。
         而且单网卡实在让我无语了。看到的亲 一定要用双卡啊!

花蜻宽 发表于 2013-3-14 06:32:36

不错不错,楼主您辛苦了。。。

xmxm76 发表于 2013-5-15 23:43:20

你的丑和你的脸没有关系。。。。。。

陈辉煌 发表于 2013-5-16 11:11:59

谢谢楼主,共同发展

fjqzyc 发表于 2013-5-17 03:56:16

老天,你让夏天和冬天同房了吧?生出这鬼天气!

shuaiwei588 发表于 2013-5-17 16:03:59

不要在一棵树上吊死,在附近几棵树上多试试死几次~

cencenhai 发表于 2013-5-18 06:59:50

长得真有创意,活得真有勇气!
页: [1]
查看完整版本: 部署openstack的前期