Introduce ipmi device emulations via qemu/virsh cmd line for the power management of the hypervisor

Introduce ipmi device emulations for the power management of the hypervisor

I. IPMI (intelligent platform maintenance interface)

II. Use the qemu & virsh command line as the "startcmd" parameter for IPMI emulations
1. for qemu command line
- Supported qemu version: at least from qemu v2.2
- How to define:
   #1 Create a BMC, normally done from ipmi_sim
   #1.1 for internal: basic BMC inside qemu, like watchdog timer.
   -device ipmi-bmc-sim,id=bmc0
   #or 1.2 for external: connects to an external BMC over a chardev, like power
   #management, watchdog timer, set sensor value.
   #(need to install OpenIPMI in the hypervisor)
   -chardev socket,id=ipmi0,host=localhost,port=9002,reconnect=10 \
   -device ipmi-bmc-extern,id=bmc1,chardev=ipmi0 \
   #2 Attach the BMC to an interface
   -device isa-ipmi-kcs,bmc=bmc1 \
   #or -device isa-ipmi-bt,bmc=bmc1 \
2. for virsh command line
- startcmd = 'virsh start/destroy/restart vm-name'
- For the guest vm, should add the ipmi simulator in its xml, like:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>vm-name</name>
...
<qemu:commandline>
<qemu:arg value='-chardev'/>
<qemu:arg value='socket,id=ipmi0,host=0.0.0.0,port=9002,reconnect=10'/>
<qemu:arg value='-device'/>
<qemu:arg value='ipmi-bmc-extern,chardev=ipmi0,id=bmc0'/>
<qemu:arg value='-device'/>
<qemu:arg value='isa-ipmi-bt,bmc=bmc0'/>
</qemu:commandline>
...
</domain>


III. Examples for external power status/on simulation
1. in the hypervisor
1.1 install OpenIPMI
$ zypper in OpenIPMI
1.2 use the default /etc/ipmi/lan.conf or config it as the following:
$ cat /etc/ipmi/lan.conf
name "ipmisim1"
set_working_mc 0x20
  startlan 1
    addr 192.168.27.126 9001
    priv_limit admin
    allowed_auths_callback none md2 md5 straight
    allowed_auths_user none md2 md5 straight
    allowed_auths_operator none md2 md5 straight
    allowed_auths_admin none md2 md5 straight
    guid a123456789abcdefa123456789abcdef
    lan_config_program "/etc/ipmi/ipmi_sim_lancontrol eth1"
  endlan
  serial 15 0.0.0.0 9002 codec VM
  startcmd "virsh start opensuse-42.3"

  startnow false

  user 1 true  ""        "test" user     10       none md2 md5 straight
  user 2 true  "ipmiusr" "test" admin    10       none md2 md5 straight

Tips:
* addr: the IP/port where the base system is listening for the ipmi client connections.
* serial: the connection to the VM ipmi device.
* startcmd: the command to run the a "power on" is issued. Either qemu command
            line or virsh command line (examples are in II.) can be used.
* user: the credentials to be used by the ipmi client.
        e.g. "ipmiusr" is the username and "test" is the password.

$ cat /etc/ipmi/imisim1.emu
# The BMC is the MC at address 20
mc_setbmc 0x20
# Now add the BMC
mc_add 0x20 0 no-device-sdrs 0x23 9 8 0x9f 0x1291 0xf02 persist_sdr
sel_enable 0x20 1000 0x0a
# Watchdog sensor.  This must be sensor zero.
sensor_add 0x20 0 0 35 0x6f event-only
sensor_set_event_support 0x20 0 0 enable scanning per-state \
        000000000001111 000000000000000 \
        000000000001111 000000000000000
# Add a temperature sensor and its SDR.  Note that sensor 0 is already
# taken as the watchdog sensor.
sensor_add 0x20 0 1 0x01 0x01
# Start with the value set to 0x60
sensor_set_value 0x20 0 1 0x60 0
# Set just the upper thresholds with the values 0x70, 0x90, and 0xa0
sensor_set_threshold 0x20 0 1 settable 111000 0xa0 0x90 0x70 00 00 00
# Enable all upper threshold events events
sensor_set_event_support 0x20 0 1 enable scanning per-state \
        000111111000000 000111111000000 \
        000111111000000 000111111000000
mc_enable 0x20

1.3 run ipmi_sim command:
$ ipmi_sim -c /etc/ipmi/lan.conf
IPMI Simulator version 1.0.13
# This is an example simulation setup for ipmi_sim.  It creates a single
# management controller as a BMC.  That will have the standard watchdog
# sensor and we add a temperature sensor.
...<snip>...
# Turn on the BMC
mc_enable 0x20
>

2. in the ipmi client
2.1 install ipmitool
$ zypper in ipmitool
2.2 test the ipmi device whether can power status/on/off the vm using ipmitool
$ ipmitool -I lanplus -H 192.168.27.126 -U ipmiusr -p 9001 power status
Password:
Chassis Power is off
$ ipmitool -I lanplus -H 192.168.27.126 -U ipmiusr -p 9001 power on
Password:
Chassis Power Control: Up/On
$ ipmitool -I lanplus -H 192.168.27.126 -U ipmiusr -P test -p 9001 power status
Chassis Power is on
$ ipmitool -I lanplus -H 192.168.27.126 -U ipmiusr -P test -p 9001 power off
Chassis Power Control: Down/off
$ ipmitool -I lanplus -H 192.168.27.126 -U ipmiusr -p 9001 power status
Password:
Chassis Power is off

Referenced link:
http://apahim.livejournal.com/2395.html
http://www.linux-kvm.org/images/7/76/03x08-Juniper-Corey_Minyard-UsingIPMIinQEMU.ods.pdf


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Metal-transfer images, also known as transfer prints or transfer films, are a valuable tool for quality control and process optimization in metalworking industries. These images are created by transferring a thin film of metal from a surface to a receptor substrate using pressure and heat, and can provide detailed information about the surface morphology and topography of the original surface. The significance of analyzing metal-transfer images lies in their ability to reveal critical details about the metalworking process, including the quality of the starting material, the effectiveness of surface preparation, and the performance of various process parameters. By carefully analyzing the morphology and topography of the metal-transfer images, engineers and technicians can gain insight into the following aspects of the metalworking process: 1. Surface roughness: Metal-transfer images can reveal the roughness of the starting surface, which is critical for ensuring proper adhesion and surface finish of the final product. High-quality metal-transfer images can provide accurate measurements of surface roughness, which can be used to optimize surface preparation processes and ensure consistent quality across multiple production runs. 2. Material quality: Metal-transfer images can also reveal the presence of defects and impurities in the starting material, which can negatively impact the final product. By carefully analyzing the metal-transfer images, engineers and technicians can identify areas of the starting material that are prone to defects or impurities, and adjust process parameters to minimize their impact. 3. Process optimization: Metal-transfer images can be used to optimize a wide range of metalworking processes, including coating, plating, and etching. By carefully analyzing the morphology and topography of the metal-transfer images, engineers and technicians can identify areas of the process that require adjustment, and fine-tune process parameters to achieve the desired outcome. In conclusion, metal-transfer images are a powerful tool for quality control and process optimization in metalworking industries. By carefully analyzing these images, engineers and technicians can gain valuable insight into the metalworking process and make adjustments to optimize quality, consistency, and efficiency. ### 回答2: 金属转移图像分析在质量控制和工艺优化中的重要性是不可否认的。金属转移图像可以提供关于金属材料转移过程中的质量和效率的关键信息,有助于改进生产过程并确保产品质量。 首先,金属转移图像可以用于质量控制。通过分析金属转移图像,可以评估金属材料转移过程中是否存在缺陷或问题。例如,图像中的熔化池的形状和大小可以显示出金属材料是否均匀融化,并且是否存在非均匀的熔化或气孔等问题。通过及时检测并纠正这些问题,可以避免产品在后续加工中的进一步损坏,并确保最终产品的质量。 其次,金属转移图像还可以用于工艺优化。通过对金属转移图像的分析,可以确定工艺参数的最佳设置。例如,通过观察图像中的熔化池形状和大小,可以判断使用的电流和焊接速度是否适当。通过调整这些参数,可以改善金属材料转移过程的效率和质量。此外,金属转移图像还可以用于研究不同工艺参数对金属转移过程的影响,从而帮助制定更精确的工艺参数和制造流程。 总而言之,通过分析金属转移图像来进行质量控制和工艺优化对于确保产品质量和生产效率至关重要。金属转移图像提供的关键信息可以帮助制造商及时识别和解决质量问题,并改进金属材料转移过程,从而实现优化的生产过程和最终产品的质量。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值