Cobbler部署指南之電源管理篇

#####################################################
##若有轉載,請務必保留本文連接及版權信息
##歡迎廣大運維同仁一塊兒交流linux/unix網站運維技術!
##QQ:335623998
##E-mail:335623998@qq.com
##博客: http://dreamway.blog.51cto.com/
##weibo:http://weibo.com/zhaixiangpan
#####################################################

《Cobbler部署指南》系列
一、《Cobbler部署指南之安裝篇》http://dreamway.blog.51cto.com/blog/1281816/1166589
二、《Cobbler部署指南之配置管理篇[上文]》
http://dreamway.blog.51cto.com/blog/1281816/1166921
三、《Cobbler部署指南之配置管理篇[下文]》
http://dreamway.blog.51cto.com/blog/1281816/1166932
python

四、《Cobbler部署指南之yum倉庫配置管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166936
linux

五、《Cobbler部署指南之Cobbler安裝操做系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166947
git

六、《Cobbler部署指南之安裝虛擬化Xen系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166950
github

七、《Cobbler部署指南之電源管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166957
vim

八、《Cobbler部署指南之FAQ處理篇》http://dreamway.blog.51cto.com/blog/1281816/1167078 centos

 

8、電源管理

8.1 測試機環境

DELL PE1950 服務器

系統CentOS5.8 64bit 運維

安裝ipmitool ide

yum install ipmitool -y 工具

 

8.2 安裝電源管理工具cman

yum install cman -y

Cobbler代碼維護者jimi告知:某些系統版本將執行程序安裝在/sbin/目錄下,經過rpm -ql cman查看,CentOS5.8下如此解決便可

ln -s /sbin/fence_* /usr/sbin/

8.3 修改電源管理python腳本

備份

cp  /usr/lib/python2.4/site-packages/cobbler/action_power.py /usr/lib/python2.4/site-packages/cobbler/action_power.py.$(date +%F)

編輯

vim /usr/lib/python2.4/site-packages/cobbler/action_power.py 

刪除或註釋此文件以下代碼

utils.die(self.logger,"command succeeded (rc=%s), but output ('%s') was not understood" % (rc, output))

刪除文件action_power.pyo action_power.pyc

這兩個文件在目錄/usr/lib/python2.4/site-packages/cobbler/

重啓cobbler,注意必定是重啓cobbler

cobbler reboot

步驟8.28.3是我在使用電源管理中發現的問題,後經過githubCobbler代碼維護者jimi溝通解決的,很是感謝他的幫助,詳見

https://github.com/cobbler/cobbler/issues/426

 

 

8.4 配置電源管理參數

爲指定的系統配置host-188116增長電源管理參數

cobbler system edit --name=host-188116  --power-address=172.17.11.20  --power-type='ipmilan'  --power-user=root  --power-pass=djxxxx

 

8.5 檢查、同步配置

cobbler check

cobbler sync

8.6 查看配置信息

cobbler system report | egrep -i "system|profile|power"

Power Management Address       : 172.17.11.20

Power Management ID            :

Power Management Password      : djxxxx

Power Management Type          : ipmilan

Power Management Username      : root

Profile                        : centos5.8-x86_64

 

8.7 Cobbler默認的電源管理配置

/etc/cobbler/settings

# settings for power management features.  optional.

# see https://github.com/cobbler/cobbler/wiki/Power-management to learn more

# choices (refer to codes.py):

#    apc_snmp bladecenter bullpap drac ether_wake ilo integrity

#    ipmilan ipmitool lpar rsa virsh wti

power_management_default_type: 'ipmitool'

 

# the commands used by the power management module are sourced

# from what directory?

power_template_dir: "/etc/cobbler/power"

8.8 使用電源管理

8.8.1 命令行操做
8.8.1.1 相關命令

cobbler system poweroff

cobbler system poweron

cobbler system powerstatus

cobbler system reboot

8.6.1.2 查看服務器電源狀態

cobbler system powerstatus --name=host-188116

task started: 2013-03-29_095803_power

task started (id=Power management (status), time=Fri Mar 29 09:58:03 2013)

cobbler power configuration is:

      type   : ipmilan

      address: 172.17.11.20

      user   : root

      id     :

running: /usr/sbin/fence_ipmilan

received on stdout: Getting status of IPMI:172.17.11.20...Chassis power = On

Done

 

received on stderr:

*** TASK COMPLETE ***

8.8.1.3 關閉服務器電源

cobbler system poweroff  --name=host-188116

task started: 2013-03-29_100218_power

task started (id=Power management (off), time=Fri Mar 29 10:02:18 2013)

cobbler power configuration is:

      type   : ipmilan

      address: 172.17.11.20

      user   : root

      id     :

running: /usr/sbin/fence_ipmilan

received on stdout: Powering off machine @ IPMI:172.17.11.20...Done

 

received on stderr:

*** TASK COMPLETE ***

8.8.1.4 啓動服務器電源

cobbler system poweron  --name=host-188116 

task started: 2013-03-29_100314_power

task started (id=Power management (on), time=Fri Mar 29 10:03:14 2013)

cobbler power configuration is:

      type   : ipmilan

      address: 172.17.11.20

      user   : root

      id     :

running: /usr/sbin/fence_ipmilan

received on stdout: Powering on machine @ IPMI:172.17.11.20...Done

 

received on stderr:

*** TASK COMPLETE ***

啓動服務器後再經過查看服務器電源狀態爲On

8.8.1.5 重啓服務器

cobbler system  reboot --name=host-188116           

task started: 2013-03-29_100508_power

task started (id=Power management (reboot), time=Fri Mar 29 10:05:08 2013)

cobbler power configuration is:

      type   : ipmilan

      address: 172.17.11.20

      user   : root

      id     :

running: /usr/sbin/fence_ipmilan

received on stdout: Powering off machine @ IPMI:172.17.11.20...Done

 

received on stderr:

cobbler power configuration is:

      type   : ipmilan

      address: 172.17.11.20

      user   : root

      id     :

running: /usr/sbin/fence_ipmilan

received on stdout: Powering on machine @ IPMI:172.17.11.20...Done

 

received on stderr:

*** TASK COMPLETE ***

8.8.1.6 經過電源管理命令自動部署操做系統

 

重啓從PXE引導啓動,並指定安裝的操做系統配置,以下命令,

cobbler system edit  --name=host-188116  --netboot-enabled=1 --profile=centos5.8-x86_64

檢查、同步配置

cobbler check

cobbler sync

 

測試上面的命令默認仍是直接從硬盤啓動,功能還不夠完善,咱們藉助ipmitool工具設置下次啓動從PXE引導,原理都是同樣的。

ipmitool -I lan -H 172.17.11.20 -U root -P djxxxx chassis bootdev pxe     

Set Boot Device to pxe

更多參數詳見

cobbler system edit --help

重啓服務器,重裝系統

cobbler system  reboot --name=host-188116

PXE引導已經生效,如圖

從指定的系統配置引導正常

能夠看到引導文件及客戶機MAC配置文件名

 

檢查依賴關係及格式化過程圖略

安裝系統軟件包以下圖

 

到這裏自動部署系統已經基本完成,系統重裝啓動後會關閉默認從PXE引導啓動。

8.8.2 Cobbler Web方式管理電源

參考資料https://github.com/cobbler/cobbler/wiki/Power-management

請看《Cobbler部署指南》系列續文

《Cobbler部署指南》系列文檔下載:http://down.51cto.com/data/745895

相關文章
相關標籤/搜索