mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(host): load guest desc hpet and video1 dev (#19530)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -51,6 +51,7 @@ type IHost interface {
|
||||
GetCpuArchitecture() string
|
||||
GetKernelVersion() string
|
||||
IsAarch64() bool
|
||||
IsX8664() bool
|
||||
GetHostTopology() *hostapi.HostTopology
|
||||
GetReservedCpusInfo() *cpuset.CPUSet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user