fix(host): load guest desc hpet and video1 dev (#19530)

This commit is contained in:
wanyaoqi
2024-02-24 07:51:36 +08:00
committed by GitHub
parent 41376e6382
commit 5abea4946d
3 changed files with 17 additions and 1 deletions
+5 -1
View File
@@ -802,6 +802,10 @@ func (s *SKVMGuestInstance) initGuestDescFromExistingGuest(
return errors.Wrap(err, "init guest memory devices")
}
s.initMachineDesc()
if s.manager.host.IsX8664() && !s.hasHpet(qtree) {
noHpet := true
s.Desc.NoHpet = &noHpet
}
// This code is designed to ensure compatibility with older guests.
// However, it is not recommended for new guests to generate a desc file from it
@@ -856,7 +860,7 @@ func (s *SKVMGuestInstance) initGuestDescFromExistingGuest(
return errors.Wrap(err, "ensure pvscsi pci address")
}
}
case "video0":
case "video0", "video1":
if s.Desc.VgaDevice == nil {
s.initGuestVga(pciRoot)
}
+11
View File
@@ -1519,6 +1519,17 @@ func (s *SKVMGuestInstance) getDiskDriverNumQueues(qtree, driver string) int64 {
return -1
}
func (s *SKVMGuestInstance) hasHpet(qtree string) bool {
var lines = strings.Split(strings.TrimSuffix(qtree, "\r\n"), "\\r\\n")
for _, line := range lines {
line := strings.TrimSpace(line)
if strings.HasPrefix(line, "dev: hpet") {
return true
}
}
return false
}
func (s *SKVMGuestInstance) getPciDevices() ([]monitor.PCIInfo, error) {
var res []monitor.PCIInfo
var errChan = make(chan error)
+1
View File
@@ -51,6 +51,7 @@ type IHost interface {
GetCpuArchitecture() string
GetKernelVersion() string
IsAarch64() bool
IsX8664() bool
GetHostTopology() *hostapi.HostTopology
GetReservedCpusInfo() *cpuset.CPUSet