Skip to content

Commit

Permalink
fix(region,host): select isolated devs misc fix (#21905)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyaoqi authored Dec 30, 2024
1 parent 8e1c0ef commit 2448bb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/compute/models/isolated_devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ func (manager *SIsolatedDeviceManager) attachHostDeviceToGuestByModel(
continue
} else {
selectedDev = &groupDevs[i].Devs[0]
break
}
}
if selectedDev != nil {
Expand All @@ -983,6 +984,8 @@ func (manager *SIsolatedDeviceManager) attachHostDeviceToGuestByModel(
if selectedDev == nil {
selectedDev = &groupDevs[0].Devs[0]
}
devAddr := strings.Split(selectedDev.Addr, "-")[0]
usedDevMap[devAddr] = selectedDev

return guest.attachIsolatedDevice(ctx, userCred, selectedDev, devConfig.NetworkIndex, devConfig.DiskIndex)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/hostman/isolated_device/isolated_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ func (man *isolatedDeviceManager) CheckDevIsNeedUpdate(dev IDevice, devInfo *Clo
if dev.GetDeviceType() != devInfo.DevType {
return true
}
if dev.GetDevicePath() != devInfo.DevicePath {
return true
}
if dev.GetModelName() != devInfo.Model {
return true
}
Expand Down

0 comments on commit 2448bb4

Please sign in to comment.