Skip to content

This python script generates a virtual BMC (Baseboard Management Controller) for an existing KVM domain

Notifications You must be signed in to change notification settings

amach4/single_kvm_bmc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This python script generates a virtual BMC (Baseboard Management Controller) for one KVM domain

Name: single_kvm_bmc.py
Author: Andreas Mach
Date: 28-03-2018

--

man page: man ipmi_sim

--

Example KVM host setup and KVM domain configuration:

https://github.com/andreas-mach/single_kvm_bmc/wiki

---

Requirements:

1- KVM domain: Configuration

  - remove all <boot order> entries like <boot order='1'/> from pre-defined KVM domain XML configuration


2- KVM host: Configuration

  - install "OpenIPMI" package which contains "ipmi_sim" BMC emulator
  
  - for SLES [12,15] replace file "/etc/ipmi/ipmisim1.emu" with the one from this Github project
  
  - add temporary KVM BMC IP address
    Note: persistent configuration is also possible see: https://github.com/andreas-mach/single_kvm_bmc/wiki

  Example:

  KVM BMC network:		192.168.8.0/24
  KVM BMC IP:			192.168.8.11
  KVM host network interface:	"em4"

  # ip address add 192.168.8.11/24 brd + dev em4
  
  # ping -c1 192.168.8.11
  PING 192.168.8.11 (192.168.8.11) 56(84) bytes of data.
  64 bytes from 192.168.8.11: icmp_seq=1 ttl=64 time=0.014 ms


3- KVM host: Create virtual IPMI interface

  - execute the python script "single_kvm_bmc.py" and enter the required information's,
    addtionally add the displayed lines to your KVM domain XML configuration, make sure correct "port=" is used


  Example:
    
  kroete:~/single_kvm_bmc-master # ./single_kvm_bmc.py 

  Please enter KVM domain name: soc-01
  Please enter KVM domain BMC IP address: 192.168.8.11
  Please enter KVM domain BMC username: root
  Please enter KVM domain BMC user password: soc

--------------------------------------------------------------------------------------------------------

  KVM domain used BMC settings:

  KVM domain: 	 	 soc-01
  KVM domain BMC IP: 	 192.168.8.11
  KVM domain BMC user: 	 root
  KVM domain BMC pass: 	 soc
  KVM domain status: 	 active
  KVM domain ID: 	 5
  KVM host "ip:port" 	 0.0.0.0:60011

--------------------------------------------------------------------------------------------------------

  Configuration files successfully created and stored in "/etc/ipmi/soc-01/"

--------------------------------------------------------------------------------------------------------

  !! IMPORTANT !! make sure your KVM domain XML includes the following lines: 

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
.
.
.
  <qemu:commandline>
    <qemu:arg value='-chardev'/>
    <qemu:arg value='socket,id=ipmi0,host=0.0.0.0,port=60011,reconnect=10'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ipmi-bmc-extern,id=bmc0,chardev=ipmi0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-ipmi-bt,bmc=bmc0'/>
  </qemu:commandline>
</domain>
--------------------------------------------------------------------------------------------------------


--

usable commands are:

 ipmitool -I lanplus -U root -P linux -H 192.168.8.11 chassis power status
 ipmitool -I lanplus -U root -P linux -H 192.168.8.11 chassis power on
 ipmitool -I lanplus -U root -P linux -H 192.168.8.11 chassis power off
 ipmitool -I lanplus -U root -P linux -H 192.168.8.11 chassis power reset
 ipmitool -I lanplus -U root -P linux -H 192.168.8.11 chassis bootdev pxe
 ipmitool -I lanplus -U root -P linux -H 192.168.8.11 chassis bootdev disk
 ipmitool -I lanplus -U root -P linux -H 192.168.8.11 chassis bootdev cdrom


--

Script Description:
(Hint: not needed to delete files, as they will be re-created using python "w" option)


Section 1 - KVM domain verification


Section 2 - set file and folder names


Section 3 - create "ipmi_sim" configuration files


Section 4 - create systemd unit file


---end---


Troubleshooting:

- for SLES [12,15] replace file "/etc/ipmi/ipmisim1.emu" with the one from this Github project
   Details of "/etc/ipmi/ipmisim1.emu":
 
   -rw-r--r-- 1 root root 1474 Jan 11 11:38 ipmisim1.emu

- execute "ipmi_sim" from cli to verify if an error occurs while testing the power status
   
   Example:

   # systemctl stop soc-01-bmc.service
   # ipmi_sim -c /etc/ipmi/soc-01/soc-01-bmc.conf

About

This python script generates a virtual BMC (Baseboard Management Controller) for an existing KVM domain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages