cobbler之电源管理

电源管理

8.1 测试机环境

DELL

系统CentOS5.8 64bit

安装ipmitool

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配置文件名

 

检查依赖关系及格式化过程图略

安装系统软件包如下图


你可能感兴趣的:(装机,cobbler)