17.7. 鉴别客户端类型及使用
下面的脚本可以鉴别系统是半虚拟客户端、全虚拟客户端还是裸机主机。
#!/bin/bash
declare -i IS_HVM=0
declare -i IS_PARA=0
check_hvm()
{
IS_X86HVM="$(strings /proc/acpi/dsdt | grep int-xen)"
if [ x"${IS_X86HVM}" != x ]; then
echo "Guest type is full-virt x86hvm"
IS_HVM=1
fi
}
check_para()
{
if $(grep -q control_d /proc/xen/capabilities); then
echo "Host is dom0"
IS_PARA=1
else
echo "Guest is para-virt domU"
IS_PARA=1
fi
}
if [ -f /proc/acpi/dsdt ]; then
check_hvm
fi
if [ ${IS_HVM} -eq 0 ]; then
if [ -f /proc/xen/capabilities ] ; then
check_para
fi
fi
if [ ${IS_HVM} -eq 0 -a ${IS_PARA} -eq 0 ]; then
echo "Baremetal platform"
fi
检查主机
要检查主机请使用 virsh capabilites
命令。
当前内容版权归 fedoraproject 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 fedoraproject .