2008年4月11日金曜日

DomUを一気に立ち上げる

ここまでで一旦、DomUを一気に作ってしまいました。
以下、コンソールに流したコマンド。

■イメージ量産
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/www01.img
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/sc01.img
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/gatekeeper01.img
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/dbm01.img
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/iwata01.img
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/stats01.img
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/mail01.img

■設定量産
cp /etc/xen/standard /etc/xen/www01
sed -i 's/name = "standard"/name = "www01"/g' /etc/xen/www01
sed -i 's/maxmem = 512/maxmem = 1024/g' /etc/xen/www01
sed -i 's/memory = 512/memory = 1024/g' /etc/xen/www01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa63001f"/g' /etc/xen/www01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/www01.img,xvda,w\" \]/g' /etc/xen/www01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:1f,bridge=xenbr0\" \]/g' /etc/xen/www01

cp /etc/xen/standard /etc/xen/sc01
sed -i 's/name = "standard"/name = "sc01"/g' /etc/xen/sc01
sed -i 's/maxmem = 512/maxmem = 1024/g' /etc/xen/sc01
sed -i 's/memory = 512/memory = 1024/g' /etc/xen/sc01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa6300d3"/g' /etc/xen/sc01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/sc01.img,xvda,w\" \]/g' /etc/xen/sc01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:d3,bridge=xenbr0\" \]/g' /etc/xen/sc01

cp /etc/xen/standard /etc/xen/gatekeeper01
sed -i 's/name = "standard"/name = "gatekeeper01"/g' /etc/xen/gatekeeper01
sed -i 's/maxmem = 512/maxmem = 256/g' /etc/xen/gatekeeper01
sed -i 's/memory = 512/memory = 256/g' /etc/xen/gatekeeper01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa63000b"/g' /etc/xen/gatekeeper01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/gatekeeper01.img,xvda,w\" \]/g' /etc/xen/gatekeeper01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:0b,bridge=xenbr0\" \]/g' /etc/xen/gatekeeper01

cp /etc/xen/standard /etc/xen/dbm01
sed -i 's/name = "standard"/name = "dbm01"/g' /etc/xen/dbm01
sed -i 's/maxmem = 512/maxmem = 1024/g' /etc/xen/dbm01
sed -i 's/memory = 512/memory = 1024/g' /etc/xen/dbm01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa630033"/g' /etc/xen/dbm01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/dbm01.img,xvda,w\" \]/g' /etc/xen/dbm01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:33,bridge=xenbr0\" \]/g' /etc/xen/dbm01

cp /etc/xen/standard /etc/xen/iwata01
sed -i 's/name = "standard"/name = "iwata01"/g' /etc/xen/iwata01
sed -i 's/maxmem = 512/maxmem = 1024/g' /etc/xen/iwata01
sed -i 's/memory = 512/memory = 1024/g' /etc/xen/iwata01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa63005b"/g' /etc/xen/iwata01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/iwata01.img,xvda,w\" \]/g' /etc/xen/iwata01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:5b,bridge=xenbr0\" \]/g' /etc/xen/iwata01

cp /etc/xen/standard /etc/xen/mail01
sed -i 's/name = "standard"/name = "mail01"/g' /etc/xen/mail01
sed -i 's/maxmem = 512/maxmem = 256/g' /etc/xen/mail01
sed -i 's/memory = 512/memory = 256/g' /etc/xen/mail01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa630047"/g' /etc/xen/mail01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/mail01.img,xvda,w\" \]/g' /etc/xen/mail01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:47,bridge=xenbr0\" \]/g' /etc/xen/mail01

cp /etc/xen/standard /etc/xen/stats01
sed -i 's/name = "standard"/name = "stats01"/g' /etc/xen/stats01
sed -i 's/maxmem = 512/maxmem = 512/g' /etc/xen/stats01
sed -i 's/memory = 512/memory = 512/g' /etc/xen/stats01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa630051"/g' /etc/xen/stats01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/stats01.img,xvda,w\" \]/g' /etc/xen/stats01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:51,bridge=xenbr0\" \]/g' /etc/xen/stats01

■DomU起動量産
xm create www01
xm create sc01
xm create gatekeeper01
xm create dbm01
xm create iwata01
xm create stats01
xm create mail01

■DomUそれぞれ処理
○www01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.31/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:1F/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=www01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot

○sc01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.211/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:D3/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=sc01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot

○gatekeeper01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.11/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:0B/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=gatekeeper01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot

○dbm01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.51/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:33/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=dbm01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot

○iwata01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.91/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:5B/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=iwata01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot

○stats01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.81/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:51/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=stats01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot

○mail01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.71/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:47/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=mail01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot

■DomU自動起動
ln -s /etc/xen/www01 /etc/xen/auto/www01
ln -s /etc/xen/sc01 /etc/xen/auto/sc01
ln -s /etc/xen/gatekeeper01 /etc/xen/auto/gatekeeper01
ln -s /etc/xen/dbm01 /etc/xen/auto/dbm01
ln -s /etc/xen/iwata01 /etc/xen/auto/iwata01
ln -s /etc/xen/stats01 /etc/xen/auto/stats01
ln -s /etc/xen/mail01 /etc/xen/auto/mail01

0 件のコメント: