尝试以下操作安装ipmitool,如果已经安装,请跳过此步。
yum install ipmitool -y
如果本机已经安装此工具,请跳过。
yum install cman -y
Cobbler代码维护者jimi告知:某些系统版本会将cman执行程序安装在/sbin/目录下,通过rpm -ql cman查看,CentOS5.8以上版本下如此解决即可
ln -s /sbin/fence_* /usr/sbin/
/usr/lib/python2.6/site-packages/cobbler/action_power.py /usr/lib/python2.6/site-packages/cobbler/action_power.py.bkk
vim /usr/lib/python2.6/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/下
service cobbler restart
我在使用电源管理中发现的问题,详见:https://github.com/cobbler/cobbler/issues/426
为指定的系统配置host-test增加电源管理参数
cobbler system edit --name=host-test --power-address=172.17.11.20 --power-type='ipmilan' --power-user=root --power-pass=xxxx
注意:host-test其实就是在Cobbler中定制的安装计划的名称,该名称具有唯一性,故此处为edit而不是add,当然,如果还没有通过cobbler system add来添加指定客户机系统配置到Cobbler 的话,可以将这些参数在添加指定客户机系统配置到Cobbler时一并添加进去。
cobbler check cobbler sync
查看配置信息
cobbler system report | egrep -i "system|profile|power" Power Management Address : 172.17.11.20 Power Management ID : Power Management Password : xxx Power Management Type : ipmilan Power Management Username : root Profile : centos6.5-x86_64
Cobbler默认的电源管理配置修改为如下
more /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"
cobbler system poweroff cobbler system poweron cobbler system powerstatus cobbler system reboot
注意:执行本节上述命令时可能会报错,报错信息可能如下:
[root@admin-host bin]# cobbler system powerstatus --name=CentOS-6.5-x86_64 task started: 2016-03-02_160433_power task started (id=Power management (status), time=Wed Mar 2 16:04:33 2016) cobbler power configuration is: type : ipmilan address: 192.168.1.101 user : root id : running: /usr/sbin/fence_ipmilan received on stdout: received on stderr: Failed: Unable to obtain correct plug status or plug is not available
解决办法如下:链接中的ipmitool工具是安装在客户机上的,而不是服务器:http://blog.sina.com.cn/s/blog_6dc1452201014j9s.html
cobbler system powerstatus --name=host-test
显示结果为:
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 ***
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 ***
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
cobbler system reboot --name=host-test
显示结果为:
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 ***
重启从PXE引导启动,并指定安装的操作系统配置,如下命令,
cobbler system edit --name=host-188116 --netboot-enabled=1 --profile=centos5.8-x86_64
检查、同步配置
cobbler check cobbler sync
更多参数详见
cobbler system edit --help
cobbler system reboot --name=host-188116