1 Star 0 Fork 0

powerpaas/machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vtx.go 775 Bytes
一键复制 编辑 原始数据 按行查看 历史
David Gageot 提交于 2016-02-17 13:35 . FIX #3065 Improve VT-X check
package virtualbox
import "strings"
// IsVTXDisabledInTheVM checks if VT-X is disabled in the started vm.
func (d *Driver) IsVTXDisabledInTheVM() (bool, error) {
lines, err := d.readVBoxLog()
if err != nil {
return true, err
}
for _, line := range lines {
if strings.Contains(line, "VT-x is disabled") && !strings.Contains(line, "Falling back to raw-mode: VT-x is disabled in the BIOS for all CPU modes") {
return true, nil
}
if strings.Contains(line, "the host CPU does NOT support HW virtualization") {
return true, nil
}
if strings.Contains(line, "VERR_VMX_UNABLE_TO_START_VM") {
return true, nil
}
if strings.Contains(line, "Power up failed") && strings.Contains(line, "VERR_VMX_NO_VMX") {
return true, nil
}
}
return false, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/powerpaas/machine.git
git@gitee.com:powerpaas/machine.git
powerpaas
machine
machine
v0.15.0-rancher2

搜索帮助